Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.7.0-Audio Freedom Lab🥼 #90

Merged
merged 46 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
98a88b4
Merge pull request #48 from muzik-apps/main-app-dev
waveyboym Feb 11, 2024
d679b51
Add AudioLab presets and WaveForm icon
waveyboym Feb 12, 2024
e23adf6
Refactor convertToEnum function to use strict equality
waveyboym Feb 12, 2024
66644a0
removing code causing merge conflict will re-add after merge
waveyboym Feb 12, 2024
39841a4
Merge pull request #50 from muzik-apps/main-app-dev
waveyboym Feb 12, 2024
a105571
Add AudioLab setting to convertToEnum function
waveyboym Feb 12, 2024
f840788
Update EqualizerSlider and AudioLabSettings styles
waveyboym Feb 23, 2024
9d0f2be
Refactor AudioLabSettings component to add delete preset functionality
waveyboym Oct 26, 2024
23016bf
Merge branch 'main-app-dev' into equalizer-dev
waveyboym Nov 16, 2024
d66c268
Enhance EqualizerSlider styles: update range input appearance and cha…
waveyboym Nov 16, 2024
87ffccd
Bump version to 0.7.0 in package files and update AboutSettings compo…
waveyboym Nov 27, 2024
ceece27
Merge pull request #79 from muzik-apps/main-app-dev
waveyboym Nov 27, 2024
57008cc
Refactor GeneralContextMenu to adjust height calculations and button …
waveyboym Nov 27, 2024
48cd767
Refactor Header.scss for improved layout and button sizing in the navbar
waveyboym Nov 27, 2024
2cd198a
Refactor argument collection and add collect_env_args command for aud…
waveyboym Nov 27, 2024
c721856
Merge pull request #81 from muzik-apps/main-app-dev
waveyboym Nov 28, 2024
0004bc6
Add Kira and Rodio audio managers; refactor audio manager structure
waveyboym Nov 28, 2024
5ce967a
Add player selection to saved object and update invoke calls for play…
waveyboym Nov 28, 2024
3e4934d
Merge branch 'adding-rodio-to-music-backend' into equalizer-dev
waveyboym Nov 29, 2024
da25603
Merge pull request #82 from muzik-apps/equalizer-dev
waveyboym Nov 29, 2024
299193b
Add output device management functions to Rodio player
waveyboym Nov 29, 2024
6c4b879
Merge branch 'adding-rodio-to-music-backend' of https://github.com/mu…
waveyboym Nov 29, 2024
5a68d87
Refactor appearance settings layout, add audio settings to saved obje…
waveyboym Nov 29, 2024
e5d7fdd
Update audio settings title to reflect audio quality options
waveyboym Nov 29, 2024
715289c
Add DeleteSongModal component and integrate into AllTracks page
waveyboym Nov 30, 2024
1bb0f53
Add crossfade and duration properties to audio managers, update playb…
waveyboym Dec 1, 2024
14f092d
Add duration parameter to song playback functions and update related …
waveyboym Dec 2, 2024
b2b18c1
Refactor FSMusicPlayer styles for improved layout and responsiveness
waveyboym Dec 2, 2024
96f6bfa
Create pull_request_template.md
waveyboym Dec 3, 2024
249a32f
Refactor keyboard shortcuts for ShowInfo action to exclude Shift key
waveyboym Dec 4, 2024
92d1ff7
Merge branch 'main-app-dev' of https://github.com/muzik-apps/muzik-of…
waveyboym Dec 4, 2024
5302330
Fix formatting and numbering in README.md for clarity and consistency
waveyboym Dec 4, 2024
98ee76b
Merge pull request #85 from muzik-apps/working
waveyboym Dec 4, 2024
9d2fbb2
Update .gitignore to exclude Python cache and executable files
waveyboym Dec 4, 2024
a8f5bad
Merge branch 'adding-rodio-to-music-backend' of https://github.com/mu…
waveyboym Dec 4, 2024
1e9e2b1
Refactor dropdown menu styles and update AudioLabSettings layout for …
waveyboym Dec 4, 2024
65b9e3a
Update README.md
waveyboym Dec 4, 2024
5354d23
Update GeneralSettings.tsx
waveyboym Dec 4, 2024
8979d60
Update Audio Lab header and refine dropdown menu styles for better UI…
waveyboym Dec 4, 2024
f1be9a6
Merge pull request #86 from muzik-apps/adding-rodio-to-music-backend
waveyboym Dec 5, 2024
7b05771
Merge branch 'working' into delete-songs-albums-genre-artist-feat
waveyboym Dec 5, 2024
6d717d1
Add delete song functionality and update related state management
waveyboym Dec 5, 2024
d50cd34
Add trash functionality for deleting songs and update related databas…
waveyboym Dec 5, 2024
ad00d2d
Merge pull request #89 from muzik-apps/delete-songs-albums-genre-arti…
waveyboym Dec 5, 2024
d04e3d5
Refactor repeating level to use enum for better readability and maint…
waveyboym Dec 7, 2024
93bfb7a
Update release name in build-and-release workflow for clarity
waveyboym Dec 7, 2024
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
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Describe your changes

## Issue ticket number and link

## Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] If it is a core feature, I have added thorough tests.
- [ ] Do we need to implement analytics?
- [ ] Will this be part of a product update? If yes, please write one phrase about this update.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: 'v__VERSION__-Speeding things up(patch)'
releaseName: 'v__VERSION__-Audio Freedom Lab🥼'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ A cross platform, local music player that is an offline(no streaming) version of
# I am a developer
## Development Cycle
1. Download <a href="https://tauri.app/v1/guides/getting-started/prerequisites">the pre-requisites</a> for tauri only by following the pre-requisites page for your operating system.
2. If you are on linux OS(debian/ubuntu), run
2. If you are on a linux based OS, run
```
sudo apt-get install libasound2-dev
```
3. Clone this repo, specifically the <a href="https://github.com/muzik-apps/muzik-offline">main-app-dev</a> branch
3. Clone this repo or fork it and clone it.
4. run
```
cd muzik-offline/muzik-offline
Expand All @@ -55,45 +55,45 @@ cd muzik-offline/muzik-offline
```
npm install
```
6. This project uses <a href="https://discord.com/developers/docs/rich-presence/how-to">discord rpc</a>, so you will need a client id, otherwise the code won't compile
6. This application uses <a href="https://discord.com/developers/docs/rich-presence/how-to">discord rpc</a>, so you will need a client id, otherwise the application won't run
7. To get a client id, setup a new application on <a href="https://discord.com/developers/applications">discord developer portal</a> and then place your client id in an ```.env``` file in the <a href="https://github.com/muzik-apps/muzik-offline/tree/main-app-dev/muzik-offline/src-tauri">src-tauri</a> directory
8. The env file should look like this:
```
DISCORD_CLIENT_ID=<Your client id goes here>
```
9. If you are on linux/macos or any unix based OS, please navigate to <a href="https://github.com/muzik-apps/muzik-offline/blob/main-app-dev/muzik-offline/src-tauri/tauri.conf.json">tauri.config.json</a> and under the ```windows``` object, change the ```decorations``` property to ```true```
10. run
9. run
```
npm run tauri dev
```
11. You can encrypt your env file with:
10. You can encrypt your env file with:
```
openssl enc -aes-256-cbc -salt -pbkdf2 -in src-tauri/.env -out src-tauri/.env.enc -pass pass:{pass-key}
```

## Building
1. Clone the <a href="https://github.com/muzik-apps/muzik-offline/tree/releases">releases</a> branch. It is the most stable and ready to go branch
2. Before you create a build, you will have to embed any env variables into the rust code otherwise the application will panic if you try to run it. The env variables are only meant to be used in the development cycle.
4. If you want to create a production build, run
1. Clone the <a href="https://github.com/muzik-apps/muzik-offline/tree/releases">releases</a> branch. It is the most stable and "ready-to-go" branch
2. If you want to create a production build, run
```
npm run tauri build
```
5. If you want to create a <a href="https://tauri.app/v1/guides/debugging/application#using-the-inspector-in-production">debug production build</a>(one where you have access to devtools), run
3. If you want to create a <a href="https://tauri.app/v1/guides/debugging/application#using-the-inspector-in-production">debug production build</a>(one where you have access to devtools), run
```
npm run tauri build -- --debug
```

Please note that when you run ```npm run tauri dev```, ```npm run tauri build``` or ```npm run tauri build -- --debug``` for the first time, it may take a lengthy amount of minutes to compile everything. However this only occurs just on your first run. In subsequent runs, it will be faster.
> [!NOTE]
> Please note that when you run ```npm run tauri dev```, ```npm run tauri build``` or ```npm run tauri build -- --debug``` for the first time, it may take a lengthy amount of minutes to compile everything. However this only occurs just on your first run. In subsequent runs, it will be faster.

# Node modules used
1. <a href="https://www.npmjs.com/package/@tauri-apps/cli">tauri-apps/api</a>
1. <a href="https://www.npmjs.com/package/@tauri-apps/cli">tauri-apps</a>
2. <a href="https://dexie.org/">dexie</a>
3. <a href="https://www.framer.com/motion/">framer motion</a>
4. <a href="https://react.dev/">react and react-dom</a>
5. <a href="https://reactrouter.com/en/main">react-router-dom</a>
6. <a href="https://www.npmjs.com/package/react-viewport-list">react viewport list</a>
7. <a href="https://sass-lang.com/">sass</a>
8. <a href="https://docs.pmnd.rs/zustand/getting-started/introduction">zustand</a>
9. <a href="https://www.npmjs.com/package/react-loading-skeleton">react-loading-skeleton</a>

# Rust libraries used
1. <a href="https://crates.io/crates/tauri">tauri</a>
Expand All @@ -111,3 +111,14 @@ Please note that when you run ```npm run tauri dev```, ```npm run tauri build```
13. <a href="https://crates.io/crates/dirs">dirs</a>
14. <a href="https://crates.io/crates/discord-rich-presence">discord-rich-presence</a>
15. <a href="https://crates.io/crates/dotenv">dotenv</a>
16. <a href="https://crates.io/crates/souvlaki">souvlaki</a>
17. <a href="https://crates.io/crates/warp">warp</a>
18. <a href="https://crates.io/crates/tauri-plugin-shell">tauri-plugin-shell</a>
19. <a href="https://crates.io/crates/tauri-plugin-notification">tauri-plugin-notification</a>
20. <a href="https://crates.io/crates/tauri-plugin-dialog">tauri-plugin-dialog</a>
21. <a href="https://crates.io/crates/tauri-plugin-http">tauri-plugin-http</a>
22. <a href="https://crates.io/crates/tauri-plugin-os">tauri-plugin-os</a>
23. <a href="https://crates.io/crates/printpdf">printpdf</a>
24. <a href="https://crates.io/crates/tabled">tabled</a>
25. <a href="https://crates.io/crates/walkdir">walkdir</a>
26. <a href="https://crates.io/crates/futures">futures</a>
5 changes: 4 additions & 1 deletion muzik-offline/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ dist-ssr
*.ntvs*
*.njsproj
*.sln
*.sw?
*.sw?

/src-airplay-cast/__pycache__/
/src-airplay-cast/*.exe
4 changes: 2 additions & 2 deletions muzik-offline/package-lock.json

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

2 changes: 1 addition & 1 deletion muzik-offline/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "muzik-offline",
"private": true,
"version": "0.6.2",
"version": "0.7.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
72 changes: 71 additions & 1 deletion muzik-offline/src-tauri/Cargo.lock

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

4 changes: 3 additions & 1 deletion muzik-offline/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "muzik-offline"
version = "0.6.2"
version = "0.7.0"
description = "A desktop music player for listening to music offline."
authors = ["Michael"]
license = "MIT"
Expand Down Expand Up @@ -40,6 +40,8 @@ printpdf = "0.7.0"
tabled = "0.16.0"
walkdir = "2.5.0"
futures = "0.3.31"
rodio = "0.20.1"
trash = "5.2.0"

[dependencies.uuid]
version = "1.11.0"
Expand Down
45 changes: 25 additions & 20 deletions muzik-offline/src-tauri/src/app/setup.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::components::audio_manager::BackendStateManager;
use crate::components::audio_manager::AppAudioManager;
use crate::components::kira_audio_manager::KiraManager;
use crate::components::rodio_audio_manager::RodioManager;
use crate::database::db_api::{get_image_from_tree, get_null_cover_from_tree, get_thumbnail, get_wallpaper};
use crate::database::db_manager::DbManager;
use kira::manager::{backend::DefaultBackend, AudioManager, AudioManagerSettings};
Expand All @@ -8,23 +10,36 @@ use warp::{http::Uri, reply::Response, Filter, Reply};

use std::sync::{Arc, Mutex};
use tauri::async_runtime::{self, spawn};
use tauri::{AppHandle, Emitter, Manager};
use tauri::Manager;
use tokio::sync::mpsc;

use crate::music::media_control_api::{config_mca, event_handler};
use crate::utils::general_utils::get_random_port;

use super::setup_macos;

/// Initializes the BackendStateManager with required settings.
pub fn initialize_audio_manager() -> Arc<Mutex<BackendStateManager>> {
/// Initializes the kira audio manager with required settings.
pub fn initialise_kira_audio_manager() -> Arc<Mutex<KiraManager>> {
let audio_manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())
.expect("failed to initialize audio manager");

Arc::new(Mutex::new(BackendStateManager {
Arc::new(Mutex::new(KiraManager {
manager: audio_manager,
instance_handle: None,
volume: 0.0,
crossfade: false,
duration: None,
}))
}

/// Initializes the Rodio audio manager with required settings.
pub fn initialise_rodio_audio_manager() -> Arc<Mutex<RodioManager>> {
Arc::new(Mutex::new(RodioManager::new()))
}

/// Initializes the AppAudioManager with required settings.
pub fn initialize_audio_manager() -> Arc<Mutex<AppAudioManager>> {
// Create a Rodio device and get the output stream handle
Arc::new(Mutex::new(AppAudioManager {
controls: None,
cover_url: String::new(),
port: 0,
Expand All @@ -38,9 +53,10 @@ pub fn setup_app(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>>
mpsc::Receiver<MediaControlEvent>,
) = mpsc::channel(32);
setup_macos::setup_macos(app)?;
let shared_audio_manager = Arc::clone(&app.state::<Arc<Mutex<BackendStateManager>>>());
let shared_audio_manager = Arc::clone(&app.state::<Arc<Mutex<AppAudioManager>>>());
let shared_db_manager = Arc::clone(&app.state::<Arc<Mutex<DbManager>>>());
let window = app.handle().clone();

// setup audio manager

// Set up the image route
let cover_image_route = create_image_route_for_covers(shared_db_manager.clone());
Expand Down Expand Up @@ -83,14 +99,13 @@ pub fn setup_app(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>>
.controls = Some(controls);

// Handle media control events
let window = app.handle().clone();
spawn(async move {
while let Some(event) = rx.recv().await {
event_handler(&window, &event);
}
});

// Collect args from the command line
collect_args(app.handle());
Ok(())
}

Expand Down Expand Up @@ -229,14 +244,4 @@ pub fn setup_media_controls(
controls,
&format!("http://localhost:{}/covers/NULL_COVER_NULL", port).to_owned(),
);
}

/// Collect args from the command line and return them as a vector of strings.
pub fn collect_args(app: &AppHandle) {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
let audio_file_path = &args[1];
app.emit("loadSong", audio_file_path)
.expect("failed to emit loadSong");
}
}
Loading