Skip to content

Commit

Permalink
fix: parsing input m and handle mute
Browse files Browse the repository at this point in the history
  • Loading branch information
neur1n committed Apr 22, 2020
1 parent 98fbd5d commit 5c4e5bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/liter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ float Liter::Down()

float Liter::Mute(float mute)
{
this->hr = this->endpoint->SetMute(mute == 0.0f, NULL);
return this->Get();
if (mute)
{
this->hr = this->endpoint->SetMute(true, NULL);
return 0.0f;
}
else
{
this->hr = this->endpoint->SetMute(false, NULL);
return this->Get();
}
}

float Liter::Set(float level)
Expand Down
9 changes: 7 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
int main(int argc, char *argv[])
{
char action = NULL;
float param = 0.0;
float param = 0.0f;
Liter liter;

while (action != 'x')
Expand All @@ -16,14 +16,19 @@ int main(int argc, char *argv[])
#endif
std::cin.clear();
std::cin >> action;
if (action == 's')
if (action == 'm' || action == 's')
{
#if DEBUG
std::cout << "Param: ";
#endif
std::cin >> param;
}

if (action == 'x')
{
return 0;
}

std::cout << liter.ParseAction(action, param) << std::endl; // Feedback volume level.
}

Expand Down

0 comments on commit 5c4e5bf

Please sign in to comment.