TemplateSoundComponent::TemplateSoundComponent(std::vector<std::string> params) : SoundComponentImpl(params) { // Read some value from the first parameter std::stringstream str; str << params[0]; int someValue; str >> someValue; // Register ports (that you have declared in the header file) // CREATE_AND_REGISTER_PORT3(<ComponentClass>, In|Out, SoundPort|ControlPort, <Name>, <Portumber> // <ComponentClass> is the name of this component // Either In or Out to specify the direction of this port // Type of the Port // <Name> as defined in the header // <Portnumber> as defined in the header // For: DECLARE_PORT3(ControlPort, TemplateControlIn, 1); CREATE_AND_REGISTER_PORT3(TemplateSoundComponent, In, ControlPort, TemplateControlIn, 1); // For: DECLARE_PORT3(ControlPort, TemplateControlOut, 1); CREATE_AND_REGISTER_PORT3(TemplateSoundComponent, Out, ControlPort, TemplateControlOut, 1); // For: DECLARE_PORT3(SoundPort, TemplateSoundIn, 2); CREATE_AND_REGISTER_PORT3(TemplateSoundComponent, In, SoundPort, TemplateSoundIn, 2); // For: DECLARE_PORT3(SoundPort, TemplateSoundOut, 2); CREATE_AND_REGISTER_PORT3(TemplateSoundComponent, Out, SoundPort, TemplateSoundOut, 2); }
Ramp::Ramp(std::vector<std::string> params) : SoundComponentImpl(params) { /* Create in ports */ CREATE_AND_REGISTER_PORT3(Ramp, In, SoundPort, SoundIn, 1); CREATE_AND_REGISTER_PORT3(Ramp, In, ControlPort, Attack, 2); CREATE_AND_REGISTER_PORT3(Ramp, In, ControlPort, Release, 3); CREATE_AND_REGISTER_PORT3(Ramp, In, ControlPort, Trigger, 4); /* Create out ports */ CREATE_AND_REGISTER_PORT3(Ramp, Out, SoundPort, SoundOut, 1); }
SawtoothSoundComponent::SawtoothSoundComponent(std::vector<std::string> params) : SoundComponentImpl(params) { m_Frequency = 0.0; m_PhaseIncr = 0.0; m_active = false; CREATE_AND_REGISTER_PORT3(SawtoothSoundComponent, In, ControlPort, FrequencyIn, 1); CREATE_AND_REGISTER_PORT3(SawtoothSoundComponent, Out, SoundPort, SoundOut, 1); }
LoggingComponent::LoggingComponent(std::vector<std::string> params) : SoundComponentImpl(params) { active = false; prefix = params.at(0); filename = params.at(1); file.open(filename.c_str()); CREATE_AND_REGISTER_PORT3(LoggingComponent, In, SoundPort, Sound, 1); CREATE_AND_REGISTER_PORT3(LoggingComponent, In, ControlPort, Trigger, 2); }
SubSCComponent::SubSCComponent( std::vector<std::string> params) : SoundComponentImpl(params) { valueToSub = 0; CREATE_AND_REGISTER_PORT3(SubSCComponent, In, SoundPort, SoundIn, 1); CREATE_AND_REGISTER_PORT3(SubSCComponent, In, ControlPort, ControlIn, 2); CREATE_AND_REGISTER_PORT3(SubSCComponent, Out, SoundPort, SoundOut, 1); }
PwmSoundComponent::PwmSoundComponent(std::vector<std::string> params) : SoundComponentImpl(params) { // Register ports (that you have declared in the header file) // CREATE_AND_REGISTER_PORT3(<ComponentClass>, In|Out, SoundPort|ControlPort, <Name>, <Portumber> // <ComponentClass> is the name of this component // Either In or Out to specify the direction of this port // Type of the Port // <Name> as defined in the header // <Portnumber> as defined in the header CREATE_AND_REGISTER_PORT3(PwmSoundComponent, In, SoundPort, PwmSoundIn, 1); // For: DECLARE_PORT3(SoundPort, TemplateSoundIn, 2); CREATE_AND_REGISTER_PORT3(PwmSoundComponent, In, SoundPort, PwmSoundIn, 2); // For: DECLARE_PORT3(SoundPort, TemplateSoundOut, 2); CREATE_AND_REGISTER_PORT3(PwmSoundComponent, Out, SoundPort, PwmSoundOut, 1); }
MulCCComponent::MulCCComponent( std::vector<std::string> params) : SoundComponentImpl(params) { value1 = 0; value2 = 0; valueResult = 0; CREATE_AND_REGISTER_PORT3(MulCCComponent, In, ControlPort, ControlIn, 1); CREATE_AND_REGISTER_PORT3(MulCCComponent, In, ControlPort, ControlIn, 2); CREATE_AND_REGISTER_PORT3(MulCCComponent, Out, ControlPort, ControlOut, 1); }
ADSRSoundComponent::ADSRSoundComponent(std::vector<std::string> params) : SoundComponentImpl(params) { /* Create in ports */ CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, SoundPort, SoundIn, 1); CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, ControlPort, Attack, 2); CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, ControlPort, Decay, 3); CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, ControlPort, Sustain, 4); CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, ControlPort, Release, 5); CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, In, ControlPort, Trigger, 6); /* Create out ports */ CREATE_AND_REGISTER_PORT3(ADSRSoundComponent, Out, SoundPort, SoundOut, 1); }
NoiseSoundComponent::NoiseSoundComponent(std::vector<std::string> params) : SoundComponentImpl(params){ CREATE_AND_REGISTER_PORT3(NoiseSoundComponent, Out, SoundPort, SoundOut, 1); }