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

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

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

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

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

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

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

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

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

@ -68,7 +68,7 @@ NS_METHOD nsSound::Beep()
return NS_OK; 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")); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsSound::Play - Not Implemented\n"));
NS_NOTYETIMPLEMENTED("nsSound::Play"); NS_NOTYETIMPLEMENTED("nsSound::Play");

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

@ -65,9 +65,15 @@ NS_METHOD nsSound::Beep()
return NS_OK; 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); ::PlaySound(filename, nsnull, SND_FILENAME | SND_NODEFAULT | SND_ASYNC);
nsCRT::free(filename);
return NS_OK; return NS_OK;
} }

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