[Stk] delete instrument then reuse

Dan Riley dpriley@ucla.edu
Sun, 2 Mar 2003 15:23:37 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C2E0CF.B2270930
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi, I'm trying to play an instrument and then switch to a different type =
of instrument and play it.

So basically I have an m_instrument object and an m_output object. At =
the beginning they are set to a BeeThree and an RTWavOut(1) respectively =
and it works fine I get some sound. Then when I want to switch the =
instrument, I do something like:

delete m_instrument;

m_instrument =3D new WhateverInstrument();

however when I go back to play it I get no sound. Do I need to delete =
and reallocate the output object as well?

------=_NextPart_000_0007_01C2E0CF.B2270930
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi, I'm trying to play an instrument =
and then=20
switch to a different type of instrument and play it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So basically I have an m_instrument =
object and an=20
m_output object. At the beginning they are set to a BeeThree and an =
RTWavOut(1)=20
respectively and it works fine I get some sound. Then when I want to =
switch the=20
instrument, I do something like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>delete m_instrument;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>m_instrument =3D new=20
WhateverInstrument();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>however when I go back to play it I get =
no sound.=20
Do I need to delete and reallocate the output object as=20
well?</FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01C2E0CF.B2270930--