Closed
Bug 313326
Opened 19 years ago
Closed 18 years ago
please fix nsSound::Play on BeOS
Categories
(Core Graveyard :: Widget: BeOS, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: timeless, Assigned: sergei_d)
References
()
Details
(Keywords: fixed1.8.1)
Attachments
(2 files, 7 obsolete files)
(deleted),
patch
|
Biesinger
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
syd was mean to you guys, BeOS is very sound capable, please undo his damage.
minor note: nsSound is currently being misused as a non service and will
probably be converted to be a service. hopefully beos won't care :).
Assignee | ||
Comment 2•19 years ago
|
||
something like that, but I didn't notice that either Play() or
PlaySystemSound() was ever called (used uncommented printfs).
Only nsSound::Beep() was called once for me.
So couldn't test till now.
Also I suspect that i should convert nsURL using GetNativePath,
and i'm unsure if autostring in PlaySystemSound() provides real full path.
Assignee | ||
Updated•19 years ago
|
Assignee: nobody → sergei_d
Assignee | ||
Comment 3•19 years ago
|
||
It works.
Managed to test nsSound::Play() from Preferences->Privacy & Security->PopupWindows
by selecting path to some sound and pushing Preview button.
Assignee | ||
Comment 4•19 years ago
|
||
removed mSound from Sound.h, fixed InitCheck()
Attachment #200409 -
Attachment is obsolete: true
Assignee | ||
Comment 5•19 years ago
|
||
oops, StreamerLoader is probably non-needed with current implementation in nSound.h.
Anyway, waiting for timeless comments
Assignee | ||
Comment 6•19 years ago
|
||
Comment on attachment 200414 [details] [diff] [review]
patch diff -up6
will try to use Init()
Attachment #200414 -
Attachment is obsolete: true
Assignee | ||
Comment 7•19 years ago
|
||
hope final for now
I was planning to look at that far into future :) Good to see it worked on.
Can one nsSound object play in polyphony? Otherwise this looks ok to me. If
destructor don't need to stop sound and such.
Assignee | ||
Comment 10•19 years ago
|
||
No, single object is intended to play only one sound.
BSimpleGameSound is rather initializer for GameSound instance with just that sound.
You need different BSimpleSound instances to play different sounds.
So, for example in game with standard set of sounds, you'd (pre)create set of
BSimpleGameSound-s - e.g. KickSound, JumpSound etc and use those for different
events.
But if you mean if it is capable to be start playing twice or more (almost)
simultaneously, e.g. from different threads, i don't know, if to be honest:(
Assignee | ||
Comment 11•19 years ago
|
||
Comment on attachment 200427 [details] [diff] [review]
patch
review request.
Though, patch may be reconsidered in future to be able to play sounds from web, if this class is supposed to do it.
Attachment #200427 -
Flags: review?(thesuckiestemail)
Comment 12•19 years ago
|
||
why does the patch work? BSimpleGameSound is documented to take filenames, not URLs. Also, why don't you need to unescape the spec?
Assignee | ||
Comment 13•19 years ago
|
||
Re:biesi
It works some way. As you see above
Probably that way i get from URL/URI normal local path acceptable for BSimpleSoundPlayer. But if you know good method to test just ::Play (not ::PlaySystemSound) and advise me about that URL->local_file_path magic, i wil be glad to fix it.
Assignee | ||
Comment 14•19 years ago
|
||
Comment on attachment 200427 [details] [diff] [review]
patch
It seems you are right biesi.
current code in ::Play() prefixes path with "http://", so any advise is welcome
Attachment #200427 -
Attachment is obsolete: true
Attachment #200427 -
Flags: review?(thesuckiestemail)
Comment 15•19 years ago
|
||
I'd use a streamloader and pass the raw data to BSimpleGameSound
Comment 16•19 years ago
|
||
or actually, nsIDownloader is probably better.
Assignee | ||
Comment 17•19 years ago
|
||
Universal version with StreamLoader
Attachment #200533 -
Flags: review?(thesuckiestemail)
Comment 18•19 years ago
|
||
Comment on attachment 200533 [details] [diff] [review]
patch
please use nsIDownloader if you want a temp file
Attachment #200533 -
Flags: review?(thesuckiestemail) → review-
Comment 19•19 years ago
|
||
OK, so if you want to change to gtk-style some day, I suppose that's ok. I don't think this is particularly great though. but please at least delete the file at some point (e.g. in the destructor)
Assignee | ||
Comment 20•19 years ago
|
||
That's not gtk-only approach. Se let it be at least in part of code similar to other platforms. It makes maintenance easier.
Removed all extra debug crap where you suspected wrong identation,
added instant unlink,
moved Init() from ::Play() to place before real BSimpleGameSound init.
Attachment #200533 -
Attachment is obsolete: true
Attachment #200537 -
Flags: review?(cbiesinger)
Assignee | ||
Comment 21•19 years ago
|
||
same as previous.
one space added, two spaces replaced by tab, one {} pair removed
Assignee | ||
Updated•19 years ago
|
Attachment #200537 -
Attachment is obsolete: true
Attachment #200537 -
Flags: review?(cbiesinger)
Assignee | ||
Updated•19 years ago
|
Attachment #200544 -
Flags: review?(cbiesinger)
Comment 22•19 years ago
|
||
Comment on attachment 200544 [details] [diff] [review]
patch
+ printf("Filed load sound file");
do you mean "Failed to load sound file"? ;)
+ nsresult rv = NS_ERROR_FAILURE;
I'd move it to the line where it is first used:
+ nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(soundTmp));
+ // also we can play it from data, but it needs parsing format and
"we can also play it from data"
+ static const char *kSoundTmpFileName = "mozsound";
I believe it's more efficient to use:
static const char kSoundTmpFileName[] = "mozsound";
hm, although that may have been ELF only...
+ //printf("Playing sound file%s\n",soundFilename.get());
I'm not a fan of commented out debug lines... can you remove it? (or put it into #ifdef DEBUG_fyysik, whatever)
+ fwrite(data, dataLen, 1, fp);
well, strictly speaking you should exchange dataLen and 1 here...
looks like lack of disk space won't be handled so well here
+ fflush(fp);
no need to do that, fclose will do that implicitly.
+ mSound = new BSimpleGameSound(soundFilename.get());
hm... why not do that in Init(), which is kinda designed for this kind of thing?
+ return rv;
this returns NS_OK if mSound was null or InitCheck() returned failure, that seems wrong...
+ printf("Play Beep\n");
should probably remove this printf...
+ NS_ENSURE_SUCCESS(rv,rv);
spaces after commas, please (many times)
r=biesi
Attachment #200544 -
Flags: review?(cbiesinger) → review+
Assignee | ||
Comment 23•19 years ago
|
||
"+ mSound = new BSimpleGameSound(soundFilename.get());
hm... why not do that in Init(), which is kinda designed for this kind of
thing?"
How? Where is parameter in Init()? Through module-wide variable? Don't look as elegant solution. Also as this isn't private method, we cannot be sure that it wouldn't be called at not so good time/place.
BSimpleGameSound(sound) is very special object and can be intialized with sound paramter only once, and only in constructor. If it has itself Init()-like method, it might be reasonble.
"+fflush(fp);
no need to do that, fclose will do that implicitly."
Yeah, i know. But i had several times strange experience with that in BeOS.
So prefer to be absolutely sure.
What may be really extra here, actually - setting no-looping flag for sound,
but again, i wish to be absolutely sure also here.
Other points taken.
Comment 24•19 years ago
|
||
> How? Where is parameter in Init()?
yeah, sorry, I missed that.
Assignee | ||
Comment 25•19 years ago
|
||
checked in trunk with biesi's corrections
Checking in mozilla/widget/src/beos/nsSound.h;
/cvsroot/mozilla/widget/src/beos/nsSound.h,v <-- nsSound.h
new revision: 1.8; previous revision: 1.7
done
Checking in mozilla/widget/src/beos/nsSound.cpp;
/cvsroot/mozilla/widget/src/beos/nsSound.cpp,v <-- nsSound.cpp
new revision: 1.21; previous revision: 1.20
done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 26•19 years ago
|
||
fixed mistypo
/cvsroot/mozilla/widget/src/beos/nsSound.cpp,v <-- nsSound.cpp
new revision: 1.22; previous revision: 1.21
and
checked in Makefile.in
Checking in mozilla/widget/src/beos/Makefile.in;
/cvsroot/mozilla/widget/src/beos/Makefile.in,v <-- Makefile.in
new revision: 1.49; previous revision: 1.48
Comment 28•18 years ago
|
||
Doug, could you check this out? I don't have a working soundcard and I needed to make a modification to work around an API change.
If you say it works I'll ask approval for the change.
Comment 29•18 years ago
|
||
Patch applies cleanly but does not build - see attachment. IIR, there was an additional "include" statement needed somewhere, but I don't remember the details. fyysik might, or I can start digging.
Assignee | ||
Comment 30•18 years ago
|
||
probably that's -lgame in Makefile.in which is missing.
Don't remember in which bug and when I really added it
Comment 31•18 years ago
|
||
(In reply to comment #30)
> probably that's -lgame in Makefile.in which is missing.
> Don't remember in which bug and when I really added it
>
-lgame needs to be added to mozilla/browser/app/Makefile.in on branch, in BeOS libs section, line 148. Same line as -ltracker. It's already in mozilla/widget/src/beos/Makefile.in, so it took me a while to figure out where else it is needed.
Tested by opening "edit/find in this page" and typing junk. It works with this change.
Updated•18 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 32•18 years ago
|
||
should probably also remove "printf("Play Beep\n");" from line 159 of patch for 1.8 branch.
Updated•18 years ago
|
Summary: please fix nsSound::Play → please fix nsSound::Play on BeOS
Comment 33•18 years ago
|
||
Removed dprintf.
Doug, please test in combination with bug 314518 in a static build. If it works and builds, it is ready to go in.
Attachment #230249 -
Attachment is obsolete: true
Attachment #230287 -
Attachment is obsolete: true
Comment 34•18 years ago
|
||
(In reply to comment #33)
> Doug, please test in combination with bug 314518 in a static build. If it works
> and builds, it is ready to go in.
>
Applied this patch plus 314518. Patches apply cleanly, sound now works OK (tested by searching for non-existent text in Edit/Find in this page)
Comment 35•18 years ago
|
||
Comment on attachment 231383 [details] [diff] [review]
Patch for 1_8 branch (2)
Requesting approval for landing in the MOZILLA_1_8_BRANCH.
This is a BeOS-only change and does not affect other platforms.
Attachment #231383 -
Flags: approval1.8.1?
Comment 36•18 years ago
|
||
Comment on attachment 231383 [details] [diff] [review]
Patch for 1_8 branch (2)
a=schrep for drivers for BeOS only change.
Attachment #231383 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Comment 37•18 years ago
|
||
Checking in mozilla/widget/src/beos/Makefile.in;
/cvsroot/mozilla/widget/src/beos/Makefile.in,v <-- Makefile.in
new revision: 1.47.14.3; previous revision: 1.47.14.2
done
Checking in mozilla/widget/src/beos/nsSound.cpp;
/cvsroot/mozilla/widget/src/beos/nsSound.cpp,v <-- nsSound.cpp
new revision: 1.19.28.1; previous revision: 1.19
done
Checking in mozilla/widget/src/beos/nsSound.h;
/cvsroot/mozilla/widget/src/beos/nsSound.h,v <-- nsSound.h
new revision: 1.7.28.1; previous revision: 1.7
done
Keywords: fixed1.8.1
Comment 38•18 years ago
|
||
This bug is fixed in the branch and the trunk, closing.
Status: REOPENED → RESOLVED
Closed: 19 years ago → 18 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•