change sound interface to use an nsIFileSpec* instead of a const char*

This commit is contained in:
pavlov%netscape.com 1999-07-24 04:58:10 +00:00
parent 3b796b29aa
commit 061e45aeec
12 changed files with 27 additions and 14 deletions

View File

@ -83,9 +83,9 @@ EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
MODULE = raptor
XPIDL_MODULE = widget
XPIDLSRCS = \
nsIFileSpecWithUI.idl \
nsISound.idl \
XPIDLSRCS = \
nsIFileSpecWithUI.idl \
nsISound.idl \
$(NULL)
include $(topsrcdir)/config/config.mk

View File

@ -17,13 +17,14 @@
*/
#include "nsISupports.idl"
#include "nsIFileSpec.idl"
[scriptable, uuid(B148EED1-236D-11d3-B35C-00A0CC3C1CDE)]
interface nsISound : nsISupports
{
void Init();
void Play(in string filename);
void Play(in nsIFileSpec filespec);
// void Stop();
void Beep();

View File

@ -65,7 +65,7 @@ NS_METHOD nsSound::Beep()
return NS_OK;
}
NS_METHOD nsSound::Play(const char *filename)
NS_METHOD nsSound::Play(nsIFileSpec *filespec)
{
NS_NOTYETIMPLEMENTED("nsSound::Play");
return NS_OK;

View File

@ -33,7 +33,7 @@ class nsSound : public nsISound {
NS_IMETHOD Init(void);
NS_IMETHOD Play(const char *filename);
NS_IMETHOD Play(nsIFileSpec *filespec);
NS_IMETHOD Beep(void);

View File

@ -102,13 +102,19 @@ NS_METHOD nsSound::Beep()
return NS_OK;
}
NS_METHOD nsSound::Play(const char *filename)
NS_METHOD nsSound::Play(nsIFileSpec *filespec)
{
if (lib)
{
char *filename;
filespec->GetNativePath(&filename);
g_print("there are some issues with playing sound right now, but this should work\n");
EsdPlayFileType EsdPlayFile = (EsdPlayFileType) PR_FindSymbol(lib, "esd_play_file");
(*EsdPlayFile)("mozilla", filename, 1);
nsCRT::free(filename);
return NS_OK;
}
return NS_OK;

View File

@ -33,7 +33,7 @@ class nsSound : public nsISound {
NS_IMETHOD Init(void);
NS_IMETHOD Play(const char *filename);
NS_IMETHOD Play(nsIFileSpec *filespec);
NS_IMETHOD Beep(void);

View File

@ -65,7 +65,7 @@ NS_METHOD nsSound::Beep()
return NS_OK;
}
NS_METHOD nsSound::Play(const char *filename)
NS_METHOD nsSound::Play(nsIFileSpec *filespec)
{
NS_NOTYETIMPLEMENTED("nsSound::Play");
return NS_OK;

View File

@ -33,7 +33,7 @@ class nsSound : public nsISound {
NS_IMETHOD Init(void);
NS_IMETHOD Play(const char *filename);
NS_IMETHOD Play(nsIFileSpec *filespec);
NS_IMETHOD Beep(void);

View File

@ -68,7 +68,7 @@ NS_METHOD nsSound::Beep()
return NS_OK;
}
NS_METHOD nsSound::Play(const char *filename)
NS_METHOD nsSound::Play(nsIFileSpec *filespec)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsSound::Play - Not Implemented\n"));
NS_NOTYETIMPLEMENTED("nsSound::Play");

View File

@ -31,7 +31,7 @@ class nsSound : public nsISound {
NS_IMETHOD Init(void);
NS_IMETHOD Play(const char *filename);
NS_IMETHOD Play(nsIFileSpec *filespec);
NS_IMETHOD Beep(void);

View File

@ -65,9 +65,15 @@ NS_METHOD nsSound::Beep()
return NS_OK;
}
NS_METHOD nsSound::Play(const char *filename)
NS_METHOD nsSound::Play(nsIFileSpec *filespec)
{
char *filename;
filespec->GetNativePath(&filename);
::PlaySound(filename, nsnull, SND_FILENAME | SND_NODEFAULT | SND_ASYNC);
nsCRT::free(filename);
return NS_OK;
}

View File

@ -31,7 +31,7 @@ class nsSound : public nsISound {
NS_IMETHOD Init(void);
NS_IMETHOD Play(const char *filename);
NS_IMETHOD Play(nsIFileSpec *filespec);
NS_IMETHOD Beep(void);