Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Inheriting from DirectX problem ! Pin
Kentamanos8-Jan-04 5:52
Kentamanos8-Jan-04 5:52 
GeneralRe: Inheriting from DirectX problem ! Pin
leppie8-Jan-04 6:13
leppie8-Jan-04 6:13 
GeneralRe: Inheriting from DirectX problem ! Pin
Heath Stewart8-Jan-04 6:14
protectorHeath Stewart8-Jan-04 6:14 
GeneralRe: Inheriting from DirectX problem ! Pin
Kentamanos8-Jan-04 6:24
Kentamanos8-Jan-04 6:24 
GeneralRe: Inheriting from DirectX problem ! Pin
leppie8-Jan-04 7:33
leppie8-Jan-04 7:33 
GeneralRe: Inheriting from DirectX problem ! Pin
leppie8-Jan-04 8:14
leppie8-Jan-04 8:14 
GeneralRe: Inheriting from DirectX problem ! Pin
pahluwalia8-Jan-04 8:02
pahluwalia8-Jan-04 8:02 
GeneralRe: Inheriting from DirectX problem ! Pin
Kentamanos8-Jan-04 9:03
Kentamanos8-Jan-04 9:03 
My original advice isn't necessarily the best way to do it. I think I understand a little better now what you're trying to do.

I'm having a hard time figuring out exactly what you're doing, but I might be able to help a bit.

First, the most important thing for you to realize is why what you tried doesn't work. The FromUrl method is a static function that returns an instance of DirectX's Audio class. This type of function is sometimes called a "factory". It's creating a new instance of the Audio class. It's similar to a constructor, but you're not using the "new" operator to create a new instance. Audio is a base class of MyAudio. So an Audio instance can never be converted to a MyAudio (only the reverse can be done).

Now, from what I can tell, you created the "MyAudio" class to simply store a string that's the original file (is this correct?). Since you're dealing with static factory method's that you still want to use and they're not virtual (so you can't override them), my opinion to you would be don't derive from Audio, but contain an Audio instead. The limitation of this is you can't pass around a MyAudio instance anywhere you normally could pass an Audio instance, but it's still not too hard to make it easy to use. For instance, consider this:

public MyAudio
{
   public MyAudio(string url, bool autoPlay)
   {
      audio = Audio.FromUrl(url, autoPlay);
      file = "???"; // Not sure what you should put here...doesn't really make sense      
   }

   public Audio
   {
      get
      {
         return audio;
      }
   }

   private Audio audio;
   private string file;
}

Then you could write code like:

MyAudio ma = new MyAudio(url, autoPlay);

and whenever you needed to do something you'd normally do with Audio, you could just call

ma.Audio

and have access to the contained DirectX Audio instance.

Does any of that help?



I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.

-David St. Hubbins
GeneralRe: Inheriting from DirectX problem ! Pin
pahluwalia9-Jan-04 2:45
pahluwalia9-Jan-04 2:45 
GeneralMultiple table data in dataGrid Pin
Hayat8-Jan-04 2:41
Hayat8-Jan-04 2:41 
GeneralRe: Multiple table data in dataGrid Pin
Mazdak8-Jan-04 3:18
Mazdak8-Jan-04 3:18 
GeneralRe: Multiple table data in dataGrid Pin
Heath Stewart8-Jan-04 6:04
protectorHeath Stewart8-Jan-04 6:04 
GeneralInexplicable errors on forms. Pin
Martin Cross8-Jan-04 0:39
Martin Cross8-Jan-04 0:39 
GeneralRe: Inexplicable errors on forms. Pin
Aryo Handono8-Jan-04 1:14
professionalAryo Handono8-Jan-04 1:14 
GeneralRe: Inexplicable errors on forms. Pin
Heath Stewart8-Jan-04 5:56
protectorHeath Stewart8-Jan-04 5:56 
GeneralRe: Inexplicable errors on forms. Pin
Martin Cross8-Jan-04 22:38
Martin Cross8-Jan-04 22:38 
GeneralRe: Inexplicable errors on forms. Pin
Niels Penneman8-Jan-04 10:50
Niels Penneman8-Jan-04 10:50 
GeneralDisposing Audio after finished playing Pin
thomasa8-Jan-04 0:19
thomasa8-Jan-04 0:19 
GeneralRe: Disposing Audio after finished playing Pin
Heath Stewart8-Jan-04 5:51
protectorHeath Stewart8-Jan-04 5:51 
GeneralDeveloping a Client/Server application Pin
Kingvest7-Jan-04 23:49
Kingvest7-Jan-04 23:49 
GeneralRe: Developing a Client/Server application Pin
Guillermo Rivero8-Jan-04 5:02
Guillermo Rivero8-Jan-04 5:02 
GeneralRe: Developing a Client/Server application Pin
Kingvest8-Jan-04 5:18
Kingvest8-Jan-04 5:18 
GeneralRe: Developing a Client/Server application Pin
Guillermo Rivero8-Jan-04 5:32
Guillermo Rivero8-Jan-04 5:32 
GeneralRe: Developing a Client/Server application Pin
Kingvest8-Jan-04 5:36
Kingvest8-Jan-04 5:36 
GeneralRe: Developing a Client/Server application Pin
Niels Penneman8-Jan-04 6:22
Niels Penneman8-Jan-04 6:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.