// Create a default player, speaker, and echo effect. TSineWave* aSine = new TSineWave(440.,TMilliseconds(500)); TAudioPlayer *aPlayer = TAudioPlayer::CreateDefaultAudioPlayer(aSine,
TAudioType::GetOffsetBinary8bit22KHz()); TSpeaker *aSpeaker =
TSpeaker::CreateDefaultSpeaker(TAudioType::GetOffsetBinary8bit22KHz()); TEcho *anEcho = TEcho::CreateDefaultEcho(TMilliseconds(1000.), 0.5, 0.5,
TAudioTYpe::GetOffsetBinary8bit22KHz()); // Create port surrogates and connect the components. TAudioOutputPortSurrogate* aPlayerOut = aPlayer->CreateLeftOutput(); TAudioInputPortSurrogate* anEchoIn = anEcho->CreateInput(); TAudioOutputPortSurrogate* anEchoOut = anEcho->CreateLeftOutput(); TAudioInputPortSurrogate* aSpeakerIn = aSpeaker->CreateInput(); aPlayerOut->ConnectTo(*anEchoIn); anEchoOut->ConnectTo(*aSpeakerIn); // Play the sound with the effect. aPlayer->Play(); aPlayer->WaitUntilComplete();