Skip to content

Commit

Permalink
Add the ability to get voicemeeter paraemters
Browse files Browse the repository at this point in the history
  • Loading branch information
rpetti committed Aug 29, 2022
1 parent 806ab61 commit 922813a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 8 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,45 @@ The properties are described in the API documentation [here](https://download.vb

## Examples

Setting the gain of the first input to 0:
### Setting the gain of the first input to 0:

```
vmcli Strip[0].Gain=0
```

Increasing the gain by 10:
### Increasing the gain by 10:

```
vmcli Strip[0].Gain+=10
```

Decreasing the gain by 10:
### Decreasing the gain by 10:

```
vmcli Strip[0].Gain-=10
```

Toggling properties:
### Toggling properties:

```
vmcli !Strip[0].Mute
```

Multiple settings can be changed at once:
### Multiple settings can be changed at once:

```
vmcli Strip[0].Mute=0 Strip[0].Gain=10 Strip[1].Mute=1
```

### Getting values:

```
vmcli Strip[0].Gain
```

Result:

```
Strip[0].Gain=0.000
```

40 changes: 37 additions & 3 deletions vmcli/vmcli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ int SetParameters(char* param)
return ret;
}

int GetParameters(char* param, char* output)
{
int ret = iVMR.VBVMR_GetParameterStringA(param, output);
if (ret != 0)
{
float val;
ret = GetParameterFloat(param, &val);
if (ret != 0)
{
return ret;
}
snprintf(output, sizeof output, "%f", val);
}
return ret;
}

int runCommand(char cmdChar[])
{
// !Parameter - Toggle value
Expand All @@ -79,10 +95,28 @@ int runCommand(char cmdChar[])
}
return TRUE;
}
// pass through the rest
// If we aren't setting, get it instead
char* paramline = const_cast<char*>(cmd.c_str());
std::cout << "passing through " << paramline << "\n";
SetParameters(paramline);
found = cmd.find("=");
if (found == std::string::npos)
{
char* value = new char[1024];
if (GetParameters(paramline, value) == 0)
{
std::cout << cmd << "=" << value << "\n";
}
else
{
std::cerr << "error getting " << paramline << "\n";
}
delete[] value;
}
else
{
// set the rest
std::cout << "setting " << paramline << "\n";
SetParameters(paramline);
}
}

int initVoicemeeter()
Expand Down

0 comments on commit 922813a

Please sign in to comment.