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

Add power #22

Merged
merged 12 commits into from
Jul 2, 2023
Merged

Add power #22

merged 12 commits into from
Jul 2, 2023

Conversation

chexq09
Copy link
Contributor

@chexq09 chexq09 commented Jun 23, 2023

Add power (dB) for #5.

PreferencesChartsPowerHeight -> "Height relative to waveforms (%%)"
PreferencesChartsPowerUnitSize -> "Points per pixel"
PreferencesChartsPowerUnitSizeDescription -> "Increase for lower image quality."
PreferencesChartsPowerUnitSizeInvalid -> "Unit size must be greater than or equal to Window size."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less than

PreferencesChartsPowerHeight -> "波形グラフの高さに対する高さの割合(%%)"
PreferencesChartsPowerUnitSize -> "データポイント/ピクセル"
PreferencesChartsPowerUnitSizeDescription -> "この値を大きくすると、グラフの描画は高速になりますが、品質は低下します。"
PreferencesChartsPowerUnitSizeInvalid -> "データポイント/ピクセルはパワーのウィンドウサイズ以上でなければなりません。"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下

PreferencesChartsPowerUnitSizeDescription -> "この値を大きくすると、グラフの描画は高速になりますが、品質は低下します。"
PreferencesChartsPowerUnitSizeInvalid -> "データポイント/ピクセルはパワーのウィンドウサイズ以上でなければなりません。"
PreferencesChartsPowerWindowSize -> "パワーのウィンドウサイズ"
PreferencesChartsPowerWindowSizeInvalid -> "パワーのウィンドウサイズはデータポイント/ピクセル以下でなければなりません。"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以上

PreferencesChartsPowerUnitSizeDescription -> "Increase for lower image quality."
PreferencesChartsPowerUnitSizeInvalid -> "Unit size must be greater than or equal to Window size."
PreferencesChartsPowerWindowSize -> "Window size"
PreferencesChartsPowerWindowSizeInvalid -> "Window size must be less than or equal to Unit size."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greater than

infoMap[moduleName to sampleFile.name]?.let {
if (it.maxSampleRate == maxSampleRate &&
it.normalize == normalize &&
it.getFile(project).exists() &&
it.lastModified == sampleFile.lastModified()
it.lastModified == sampleFile.lastModified() &&
((mergeChannels && it.powerChannels == 1) || (!mergeChannels && it.channels == it.powerChannels))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we will need to check hasPower and hasSpectrogram as well?
We can have a member function in SampleInfo class to handle this logic.

fun shouldReload(appConf: AppConf, algorithmVersion: Int, ...): Boolean = ...

@@ -186,7 +186,8 @@ class EditorState(
val updated = chartStore.prepareForNewLoading(project, appConf, it)
appState.updateProjectOnLoadedSample(it, moduleName)
if (updated) {
val renderProgressTotal = it.chunkCount * (it.channels + if (it.hasSpectrogram) 1 else 0)
val renderProgressTotal = it.chunkCount *
(it.channels + (if (it.hasSpectrogram) 1 else 0) + (if (it.hasPower) it.powerChannels else 0))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update totalCharts in ChartPrerenderer.kt L72 as well. Since the logic is the same, we can have a property in SampleInfo :

val SampleInfo.totalChartCount: Int get() = ...

@@ -63,7 +65,11 @@ object SampleInfoRepository {
existingInfo.normalize == normalize &&
existingInfo.maxSampleRate == maxSampleRate &&
existingInfo.getFile(project).exists() &&
existingInfo.lastModified == sampleFile.lastModified()
existingInfo.lastModified == sampleFile.lastModified() &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment above

@sdercolin sdercolin merged commit 664931c into sdercolin:dev Jul 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants