🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.sys.mac
Article #62806

[Programming] Play sound asynchronously

#62806
From: SUMIYA Takahiro
Date: Wed, 03 Feb 1993 09:51
63 lines
2542 bytes
$@9-Bg$N6yC+$H$$$$$^$9(J. 

$@$I$J$?$+0J2<$NE@$K$D$$$F8f65<(2<$5$$(J
$@$h$m$7$/$*4j$$$7$^$9(J (_._)

SoundManager $@$N(J SndPlay $@$r;H$C$F2;$rHsF14|$KLD$i$7$?$$;~$K(J, $@;d$O(J <List
1> $@$N$h$&$K$7$F$$$k$N$G$9(J$@$,(J, $@$3$l$r(J System 6.07 $@$G$d$k$HGzCF$,=P$k$3$H(J
$@$,$"$j$^$9!%;EJ}$,$J$$$N$G(J <List 2> $@$N$h$&$K2;$rLD$i$9$4(J$@$H$K(J 
SndChannel $@$N3dEv$r$9$k$H(J, $@GzCF$O=P$^$;$s$,(J, $@C;$$4V3V$GO"B3$7$FLD$i$7(J
$@$?;~$K(J, $@4V$K!V%V%C!W$H$$$C(J$@$?IT2w$J%/%j%C%/2;$,F~$C$F$7$^$$$^$9(J. $@HsF14|(J
$@$K2;$r=P$9$?$a$N!V@5$7$$!W$d$jJ}$O$I$&$J$N$G$7$g$&$+!)(J

$@$^$?(J, $@$3$l$K4XO"$7$?OC$+$bCN$l$^$;$s$,(J, 
         SndSoundManagerVersion();
$@$GF@$i$l$k%l%3!<%I$K$O(J bugFixRev $@$H$$$&%U%#!<%k%I$,$"$j$^$9$,(J, $@$3$l$O(J
$@2?$r0UL#$9$k$N$G$7$g$&$+(J.

-<List 1>-------------------------------------------------------------
SndChannelPtr _chan=0L;
main() {
	...
	SndNewChannel(&_chan,sampledSynth,0,0L);
	...
	sound_effect(sound);
	...
	SndDisposeChannel(_chan,true);
}

void sound_effect(Hanlde sound) {
	SndCommand quiet={quietCmd,0,0};
	if(sound && *sound && *_chan) {
		SndDoImmediate(_chan,&quiet);
		SndPlay(_chan,sound,true);
	}
}

-<List 2>-------------------------------------------------------------
SndChannelPtr _chan=0L;
main() {
	...
	sound_effect(sound);
	...
	if(*chan)
		SndDisposeChannel(*chan,true);
}

void sound_effent(Handle sound) {
	if(*chan) {
		SndDisposeChannel(*chan,true);
		*chan=0L;
	}
	SndNewChannel(chan,0,0,0L);
	if(*chan && sound && *sound)
		SndPlay(*chan,sound,true);
}


$@!t(J $@%5%V%8%'%/%H$rJQ$($?$+$C$?$N$GJ,$1$FEj9F$7$^$7$?$,(J, $@0l$D$K$7$?J}$,(J
$@!t(J $@NI$+$C$?(J$@$G$7$g$&$+!)(J

--
---
----- $@9-EgBg3X(J  $@Am9g2J3XIt(J  $@6yC+9'MN(J (sumi@cuby.mis.hiroshima-u.ac.jp)
Technical Details
Message-ID: <SUMI.93Feb3185140@cuby.mis.hiroshima-u.ac.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!s.u-tokyo!kuis!wnoc-kyo!hiroshima-u!grape!humpty!humpty!sumi

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: f514d,304c26ac0a9548b4,start
X-Google-Attributes: gidf514d,public
X-Google-ArrivalTime: 1993-02-03 01:51:40 PST
Newsgroups: fj.sys.mac
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!s.u-tokyo!kuis!wnoc-kyo!hiroshima-u!grape!humpty!humpty!sumi
From: sumi@cuby.mis.hiroshima-u.ac.jp (SUMIYA Takahiro)
Subject: [Programming] Play sound asynchronously 
Message-ID: <SUMI.93Feb3185140@cuby.mis.hiroshima-u.ac.jp>
Sender: news@humpty.mis.hiroshima-u.ac.jp
Nntp-Posting-Host: cuby
Organization: Dept. of Integrate Arts and Sciences, Hiroshima University
Distribution: fj
Date: Wed, 3 Feb 1993 09:51:40 GMT
Lines: 63