Skip to content

Commit

Permalink
Merge pull request #111 from solaoi/main
Browse files Browse the repository at this point in the history
Lycoris v0.9.7
  • Loading branch information
solaoi authored Mar 30, 2024
2 parents 3cd103a + ae1e170 commit 97a783b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 10 deletions.
14 changes: 12 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fn start_command(
transcription_accuracy,
note_id,
stop_record_rx,
Arc::new(Mutex::new(false)),
);
} else if device_type == "desktop" {
let record_desktop =
Expand All @@ -104,6 +105,7 @@ fn start_command(
note_id,
stop_record_rx,
None,
Arc::new(Mutex::new(false)),
);
} else {
let record = module::record::Record::new(window.app_handle().clone());
Expand All @@ -112,21 +114,29 @@ fn start_command(

let (stop_record_clone_tx, stop_record_clone_rx) = unbounded();
let speaker_language_clone = speaker_language.clone();
let transcription_accuracy_clone = transcription_accuracy.clone();

let should_stop_other_transcription = Arc::new(Mutex::new(false));
let should_stop_other_transcription_clone =
Arc::clone(&should_stop_other_transcription);

std::thread::spawn(move || {
record_desktop.start(
speaker_language_clone,
transcription_accuracy,
transcription_accuracy_clone,
note_id,
stop_record_rx,
Some(stop_record_clone_tx),
should_stop_other_transcription_clone,
);
});
record.start(
device_label,
speaker_language,
"off".to_string(),
transcription_accuracy,
note_id,
stop_record_clone_rx.clone(),
should_stop_other_transcription,
);
}
});
Expand Down
15 changes: 14 additions & 1 deletion src-tauri/src/module/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ impl Record {
transcription_accuracy: String,
note_id: u64,
stop_record_rx: Receiver<()>,
should_stop_other_transcription: Arc<Mutex<bool>>,
) {
let should_stop_other_transcription_on_record =
*should_stop_other_transcription.lock().unwrap();
if !should_stop_other_transcription_on_record {
let mut lock = should_stop_other_transcription.lock().unwrap();
*lock = true;
drop(lock);
}

let host = cpal::default_host();
let device = host
.input_devices()
Expand Down Expand Up @@ -175,12 +184,16 @@ impl Record {
.lock()
.unwrap()
.replace(Writer::build(&audio_path.to_str().expect("error"), spec));
if !is_no_transcription && !*is_converting.lock().unwrap() {
if !is_no_transcription
&& !*is_converting.lock().unwrap()
&& !should_stop_other_transcription_on_record
{
let is_converting_clone = Arc::clone(&is_converting);
let app_handle_clone = app_handle.clone();
let stop_convert_rx_clone = stop_convert_rx.clone();
let transcription_accuracy_clone = transcription_accuracy.clone();
let speaker_language_clone = speaker_language.clone();

std::thread::spawn(move || {
let mut lock = is_converting_clone.lock().unwrap();
*lock = true;
Expand Down
15 changes: 14 additions & 1 deletion src-tauri/src/module/record_desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,16 @@ impl RecordDesktop {
note_id: u64,
stop_record_rx: Receiver<()>,
stop_record_clone_tx: Option<Sender<()>>,
should_stop_other_transcription: Arc<Mutex<bool>>,
) {
let should_stop_other_transcription_on_record_desktop =
*should_stop_other_transcription.lock().unwrap();
if !should_stop_other_transcription_on_record_desktop {
let mut lock = should_stop_other_transcription.lock().unwrap();
*lock = true;
drop(lock);
}

let mut current = SCShareableContent::current();
let display = current.displays.pop().unwrap();

Expand Down Expand Up @@ -206,12 +215,16 @@ impl RecordDesktop {
.lock()
.unwrap()
.replace(Writer::build(&audio_path.to_str().expect("error"), spec));
if !is_no_transcription && !*is_converting.lock().unwrap() {
if !is_no_transcription
&& !*is_converting.lock().unwrap()
&& !should_stop_other_transcription_on_record_desktop
{
let is_converting_clone = Arc::clone(&is_converting);
let app_handle_clone = app_handle.clone();
let stop_convert_rx_clone = stop_convert_rx.clone();
let transcription_accuracy_clone = transcription_accuracy.clone();
let speaker_language_clone = speaker_language.clone();

std::thread::spawn(move || {
let mut lock = is_converting_clone.lock().unwrap();
*lock = true;
Expand Down
5 changes: 3 additions & 2 deletions src/components/molecules/AudioDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const AudioDevices = (): JSX.Element => {
</div>
<div className="opacity-0 w-24 invisible rounded text-[12px]
font-bold text-white py-1 bg-slate-600 top-12 left-4
group-hover:visible opacity-100 absolute ">利用する音源
group-hover:visible opacity-100 absolute">利用する音源
</div>
</label> : <label ref={dropdownRef} onMouseDown={e => checkAndCloseDropDown(e.currentTarget)} tabIndex={0} className="group normal-case btn w-52 flex justify-between" style={{ color: "inherit", backgroundColor: "hsl(var(--b1) / var(--tw-bg-opacity))", border: "1px solid hsl(var(--bc) / 0.2)" }}
>
Expand Down Expand Up @@ -155,7 +155,8 @@ const AudioDevices = (): JSX.Element => {
</label>
</div>
</li>
{showAudioSource && <ul className="max-h-56 overflow-y-scroll rounded-box" style={{ borderTopLeftRadius: 0, borderTopRightRadius: 0 }}>
{showAudioSource && <ul className="max-h-56 overflow-y-scroll rounded-box scrollbar-transparent"
style={{ borderTopLeftRadius: 0, borderTopRightRadius: 0 }}>
{audioDevices.map((device, i) => (
<li key={"audio-device_" + i}>
<label className="label inline-flex active:bg-inherit">
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/SpeakerLanguage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const SpeakerLanguage = (): JSX.Element => {
<ul tabIndex={0} className="dropdown-content menu rounded-box w-52"
style={{ backgroundColor: "hsl(var(--b1) / var(--tw-bg-opacity))", border: "1px solid hsl(var(--bc) / 0.2)" }}
>
{downloadedModels.length > 0 && <ul className="max-h-56 overflow-y-scroll rounded-box">
{downloadedModels.length > 0 && <ul className="max-h-56 overflow-y-scroll rounded-box scrollbar-transparent">
{downloadedModels.map((model, i) => (
<li key={"speaker-language_" + i}>
<label className="label inline-flex active:bg-inherit">
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/TranscriptionAccuracy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const TranscriptionAccuracy = (): JSX.Element => {
<ul tabIndex={0} className="dropdown-content menu rounded-box w-52"
style={{ backgroundColor: "hsl(var(--b1) / var(--tw-bg-opacity))", border: "1px solid hsl(var(--bc) / 0.2)" }}
>
<ul className="max-h-56 overflow-y-scroll rounded-box">
<ul className="max-h-56 overflow-y-scroll rounded-box scrollbar-transparent">
<li key="transcription-accuracy_off">
<label className="label inline-flex active:bg-inherit">
<input type="radio" name="trace-option" className="radio radio-accent" onChange={change} value="off" checked={transcriptionAccuracy === "off"} />
Expand Down
4 changes: 3 additions & 1 deletion src/components/organisms/NoteMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ const NoteMain = (): JSX.Element => {
</div>
<NoteFooter titleRef={inputEl} />
</div>
<div className={"flex justify-center items-center w-8 h-8 fixed bottom-0 right-0 mb-1 mr-5 bg-base-200 rounded-lg drop-shadow-lg cursor-pointer hover:bg-base-300" + (!showGotoBottom && " hidden")} onClick={() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }}>
<div className="flex justify-center items-center w-8 h-8 fixed bottom-0 right-0 mb-1 mr-5 bg-base-200 rounded-lg drop-shadow-lg cursor-pointer hover:bg-base-300"
style={!showGotoBottom ? { display: "none" } : {}}
onClick={() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }}>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className={"w-6 h-6"}>
<path strokeLinecap="round" strokeLinejoin="round" d="M19.5 5.25l-7.5 7.5-7.5-7.5m15 6l-7.5 7.5-7.5-7.5" />
</svg>
Expand Down
6 changes: 5 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ body {
transform: scale(1, 1);
opacity: 1;
}
}
}

.scrollbar-transparent::-webkit-scrollbar {
display: none;
}

0 comments on commit 97a783b

Please sign in to comment.