Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PenguinWave/RunConfigurations/DevAppRun.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="DevAppRun" type="CompoundRunConfigurationType">
<toRun name="RunTauriApp" type="CargoCommandRunConfiguration" />
<toRun name="RunTauriApp" targetId="RsBuildProfile:dev" type="CargoCommandRunConfiguration" />
<toRun name="RunDevServer" type="js.build_tools.npm" />
<method v="2" />
</configuration>
Expand Down
46 changes: 46 additions & 0 deletions PenguinWave/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions PenguinWave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"tauri:build": "ARCH=x86_64 NO_STRIP=1 npx tauri build"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
"@tauri-apps/plugin-shell": "^2.2.1",
Expand Down
33 changes: 30 additions & 3 deletions PenguinWave/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod headsets;
mod system;
mod utils;
use crate::event::chatmix_listener::{init_chatmix_monitor, ChatMixMonitoringState};
use crate::system::pipewire::{init_virtual_channels, PipeWireManager};
use crate::system::pipewire::{init_virtual_channels, PipeWireManager, PipeWireNode, ApplicationStream};
use crate::utils::hardware_utils::*;
use crate::utils::state::AppStateManager;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -37,8 +37,7 @@ fn greet(name: &str) -> String {
for (i, device_list) in devices.iter().enumerate() {
let battery = device_list.device.request_battery();
let chatmix = device_list.device.request_chatmix();
//let volume = device_list.device.set_microphone_volume(255).unwrap();
//let response = device_list.device.set_sidetone(0).unwrap();

device_info.push_str(&format!(
"Device #{}: VID: 0x{:04X}, PID: 0x{:04X} #{:?} #{} Chatmix #{}\n",
i + 1,
Expand Down Expand Up @@ -73,6 +72,13 @@ struct LinkRequest {
target_port: String,
}

#[derive(Debug, Serialize, Deserialize)]
struct MoveStreamRequest {
application_id: u32,
sink_id: u32,
}


// Struct for HID device lookup
#[derive(Debug, Serialize, Deserialize)]
struct HidDeviceRequest {
Expand Down Expand Up @@ -114,6 +120,24 @@ fn link_ports(request: LinkRequest) -> Result<(), String> {
.map_err(|e| e.to_string())
}

#[tauri::command]
fn get_custom_virtual_sinks() -> Result<Vec<PipeWireNode>, String> {
PipeWireManager::get_custom_virtual_sinks()
.map_err(|e| e.to_string())
}

#[tauri::command]
fn get_application_streams() -> Result<Vec<ApplicationStream>, String> {
PipeWireManager::list_application_streams()
.map_err(|e| e.to_string())
}

#[tauri::command]
fn move_application_to_sink(request: MoveStreamRequest) -> Result<(), String> {
PipeWireManager::move_application_to_sink(request.application_id, request.sink_id)
.map_err(|e| e.to_string())
}


#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
Expand Down Expand Up @@ -145,6 +169,9 @@ pub fn run() {
list_nodes,
get_output_devices,
link_ports,
get_custom_virtual_sinks,
get_application_streams,
move_application_to_sink
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
Loading