60 lines
1.1 KiB
D
60 lines
1.1 KiB
D
module amplifier;
|
|
|
|
import tuner, streamingplayer;
|
|
import std.stdio : writeln;
|
|
import std.conv : to;
|
|
|
|
class Amplifier
|
|
{
|
|
private string description;
|
|
private Tuner tuner;
|
|
private StreamingPlayer player;
|
|
|
|
this(string description)
|
|
{
|
|
this.description = description;
|
|
}
|
|
|
|
void on()
|
|
{
|
|
writeln(description ~ " on");
|
|
}
|
|
|
|
void off()
|
|
{
|
|
writeln(description ~ " off");
|
|
}
|
|
|
|
void setStereoSound()
|
|
{
|
|
writeln(description ~ " stereo mode on");
|
|
}
|
|
|
|
void setSurroundSound()
|
|
{
|
|
writeln(description ~ " surround sound on (5 speakers, 1 subwoofer)");
|
|
}
|
|
|
|
void setVolume(int level)
|
|
{
|
|
writeln(description ~ " setting volume to " ~ level.to!string);
|
|
}
|
|
|
|
void setTuner(Tuner tuner)
|
|
{
|
|
writeln(description ~ " setting tuner to " ~ tuner.to!string);
|
|
this.tuner = tuner;
|
|
}
|
|
|
|
void setStreamingPlayer(StreamingPlayer player)
|
|
{
|
|
writeln(description ~ " setting Streaming player to " ~ player.to!string);
|
|
this.player = player;
|
|
}
|
|
|
|
override string toString() const
|
|
{
|
|
return description;
|
|
}
|
|
}
|