Skip to content

Commit 5f4943a

Browse files
committed
Versión 0.0.7 minor changes
1 parent d0d932b commit 5f4943a

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.0.7
2+
* UPDATE Readme.md
3+
* ```softwarePath``` Now it's not mandatory, it's optional.
4+
Indicating the path or else it will look for it in the compilation files of the program.
5+
6+
## 0.0.6
7+
* UPDATE Readme.md
8+
19
## 0.0.5
210
* UPDATE Readme.md
311
* Added ```setAppDefault``` method

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ await soundVolumeView.setVolume(soundVolumeView.captureDevices[index], 100);
6060
await soundVolumeView.setListenToThisDevice(devices[index], listen: true);
6161
```
6262

63-
#### You can also set the sound output to the recording line or application devices
63+
#### You can also set the sound output to the recording line
6464
```dart
65-
await soundVolumeView.setListenToThisDevice(devices[index], listen: true);
65+
Device outputDevice = soundVolumeView.outputDevices.firstWhere(( device ) => device.itemID == value);
66+
await soundVolumeView.setPlaybackThroughDevice(soundVolumeView.captureDevices[index], outputDevice);
6667
```
6768

6869
#### DefaultType: all - Set all default types (Console, Multimedia, and Communications)

SoundVolumeView.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[General]
22
MarkOddEvenRows=0
33
ShowGridLines=0
4-
SaveFilterIndex=0
4+
SaveFilterIndex=8
55
ShowInfoTip=1
66
AutoRefresh=1
77
TrayIcon=0
@@ -17,7 +17,7 @@ ShowDisabledDevices=0
1717
ShowUnpluggedDevices=0
1818
AlignNumbersToRight=0
1919
SelectedChannel=0
20-
WinPos=2C 00 00 00 00 00 00 00 01 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF D5 01 00 00 64 01 00 00 AB 07 00 00 32 04 00 00
20+
WinPos=2C 00 00 00 00 00 00 00 02 00 00 00 00 83 FF FF 00 83 FF FF FF FF FF FF FF FF FF FF BA 00 00 00 17 01 00 00 90 06 00 00 E5 03 00 00
2121
Columns=96 00 00 00 78 00 01 00 5A 00 02 00 96 00 03 00 64 00 04 00 64 00 05 00 64 00 06 00 64 00 07 00 64 00 08 00 78 00 09 00 78 00 0A 00 78 00 0B 00 78 00 0C 00 78 00 0D 00 5E 01 0E 00 5E 01 0F 00 5E 01 10 00 96 00 11 00 96 00 12 00 2C 01 13 00 64 00 14 00 96 00 15 00 FA 00 16 00
2222
Sort=0
2323
[RecentFiles]

lib/src/core/initial.dart

+17-12
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import 'package:sound_volume_view/src/models/device.dart';
1414
1515
// DOCUMENTATION HERE: https://www.nirsoft.net/utils/sound_volume_view.html#command_line
1616
class SoundVolumeView {
17-
SoundVolumeView({required this.softwarePath});
17+
SoundVolumeView({this.softwarePath});
1818

1919
/// [softwarePath] Absolute path of where SoundVolumeView.exe is located
20-
String softwarePath;
20+
String? softwarePath;
2121

2222
/// [_softwareName] Name of the application to run
2323
final String _softwareName = 'SoundVolumeView.exe';
@@ -38,16 +38,21 @@ class SoundVolumeView {
3838
// /SaveFileEncoding 3 = UTF-8
3939
Future<List<Device>> _getDevices() async {
4040
String filenameToGenerate = 'devices.json';
41-
String path = join(softwarePath, _softwareName);
42-
String devicesPath = join(softwarePath, filenameToGenerate);
41+
if( softwarePath == null ){
42+
int lastPosition = Platform.resolvedExecutable.lastIndexOf('\\');
43+
String pathAbsoluteSoftware = Platform.resolvedExecutable.substring(0, lastPosition);
44+
softwarePath = pathAbsoluteSoftware+'\\';
45+
}
46+
String path = join(softwarePath!, _softwareName);
47+
String devicesPath = join(softwarePath!, filenameToGenerate);
4348
File file = File(devicesPath);
4449
captureDevices.clear();
4550
outputDevices.clear();
4651
applicationDevices.clear();
4752
if (await file.exists()) {
4853
await file.delete();
4954
}
50-
String pathSave = join(softwarePath, filenameToGenerate);
55+
String pathSave = join(softwarePath!, filenameToGenerate);
5156
final Shell shell = Shell();
5257
await shell.run('$path /SaveFileEncoding 3 /sjson $pathSave');
5358

@@ -73,22 +78,22 @@ class SoundVolumeView {
7378

7479
/// [setVolume] Will lower or raise the volume to the indicated device - 0% to 100%
7580
Future<void> setVolume(Device device, int volume) async {
76-
String path = join(softwarePath, _softwareName);
81+
String path = join(softwarePath!, _softwareName);
7782
final Shell shell = Shell();
7883
await shell.run('$path /SetVolume ${device.name} $volume');
7984
}
8085

8186
/// [mute] mute the device
8287
Future<void> mute(Device device) async {
83-
String path = join(softwarePath, _softwareName);
88+
String path = join(softwarePath!, _softwareName);
8489
final Shell shell = Shell();
8590
device.muted = 'Yes';
8691
await shell.run('$path /mute ${device.name}');
8792
}
8893

8994
/// [unMute] Turn on device sound
9095
Future<void> unMute(Device device) async {
91-
String path = join(softwarePath, _softwareName);
96+
String path = join(softwarePath!, _softwareName);
9297
final Shell shell = Shell();
9398
device.muted = 'No';
9499
await shell.run('$path /UnMute ${device.name}');
@@ -97,7 +102,7 @@ class SoundVolumeView {
97102
/// [setPlaybackThroughDevice] Assigns the output device to the recording line signal
98103
Future<void> setPlaybackThroughDevice(
99104
Device recordingDevice, Device playbackDevice) async {
100-
String path = join(softwarePath, _softwareName);
105+
String path = join(softwarePath!, _softwareName);
101106
final Shell shell = Shell();
102107
await shell.run(
103108
'$path /SetPlaybackThroughDevice "${recordingDevice.name}" ${playbackDevice.itemID}');
@@ -106,7 +111,7 @@ class SoundVolumeView {
106111
/// [setListenToThisDevice] Enable or disable recording line preview
107112
Future<void> setListenToThisDevice(Device device,
108113
{bool listen = true}) async {
109-
String path = join(softwarePath, _softwareName);
114+
String path = join(softwarePath!, _softwareName);
110115
final Shell shell = Shell();
111116
await shell
112117
.run('$path /SetListenToThisDevice ${device.name} ${listen ? 1 : 0}');
@@ -115,7 +120,7 @@ class SoundVolumeView {
115120
/// [setAppDefault] Allows you to set the default render/capture device for specfic application.
116121
Future<void> setAppDefault(Device applicationDevice, Device outputDevice,
117122
{DefaultType defaultType = DefaultType.multimedia}) async {
118-
String path = join(softwarePath, _softwareName);
123+
String path = join(softwarePath!, _softwareName);
119124
final Shell shell = Shell();
120125
switch (defaultType) {
121126
case DefaultType.console:
@@ -140,7 +145,7 @@ class SoundVolumeView {
140145
/// [setDefault] Output devices set all default types (Console, Multimedia, and Communications)
141146
Future<void> setDefault(Device outputDevice,
142147
{DefaultType defaultType = DefaultType.all}) async {
143-
String path = join(softwarePath, _softwareName);
148+
String path = join(softwarePath!, _softwareName);
144149
final Shell shell = Shell();
145150
switch (defaultType) {
146151
case DefaultType.console:

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: sound_volume_view
22
description: SoundVolumeView that displays general information and the current volume level for all active sound components in your system, and allows you to instantly mute and unmute them.
33
homepage: https://github.com/DomingoMG/sound_volume_view
44
repository: https://github.com/DomingoMG/sound_volume_view
5-
version: 0.0.5
5+
version: 0.0.7
66

77
environment:
88
sdk: ">=2.16.0 <3.0.0"

0 commit comments

Comments
 (0)