diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lukas/music/song/voice/Voice.kt b/app/src/main/java/com/lukas/music/song/voice/Voice.kt index 1408362..139be78 100644 --- a/app/src/main/java/com/lukas/music/song/voice/Voice.kt +++ b/app/src/main/java/com/lukas/music/song/voice/Voice.kt @@ -24,6 +24,8 @@ var restrikeNotes = false lateinit var noteActive: Array> + var octaveOffset = 0 + init { type = type } @@ -36,7 +38,7 @@ val activeNotes = noteActive[beatIndex] val notes = type.getNotes(root, chordNotes) for ((index, active) in activeNotes.withIndex()) { - val note = notes[index] + val note = notes[index] + 12 * octaveOffset if (!active) { instrument.stopNote(note) continue diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lukas/music/song/voice/Voice.kt b/app/src/main/java/com/lukas/music/song/voice/Voice.kt index 1408362..139be78 100644 --- a/app/src/main/java/com/lukas/music/song/voice/Voice.kt +++ b/app/src/main/java/com/lukas/music/song/voice/Voice.kt @@ -24,6 +24,8 @@ var restrikeNotes = false lateinit var noteActive: Array> + var octaveOffset = 0 + init { type = type } @@ -36,7 +38,7 @@ val activeNotes = noteActive[beatIndex] val notes = type.getNotes(root, chordNotes) for ((index, active) in activeNotes.withIndex()) { - val note = notes[index] + val note = notes[index] + 12 * octaveOffset if (!active) { instrument.stopNote(note) continue diff --git a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt index cba0063..e254674 100644 --- a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt +++ b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt @@ -17,7 +17,7 @@ val noteCount: Int, val getNotes: (Note, Array) -> Array ) { - Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0] - 24) }), + Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0]) }), Chord("Chord Notes", 3, { _, chordNotes -> chordNotes }), RootRelative("Song root relative", 12, { root, _ -> Array(12) { root + it } }), ; diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lukas/music/song/voice/Voice.kt b/app/src/main/java/com/lukas/music/song/voice/Voice.kt index 1408362..139be78 100644 --- a/app/src/main/java/com/lukas/music/song/voice/Voice.kt +++ b/app/src/main/java/com/lukas/music/song/voice/Voice.kt @@ -24,6 +24,8 @@ var restrikeNotes = false lateinit var noteActive: Array> + var octaveOffset = 0 + init { type = type } @@ -36,7 +38,7 @@ val activeNotes = noteActive[beatIndex] val notes = type.getNotes(root, chordNotes) for ((index, active) in activeNotes.withIndex()) { - val note = notes[index] + val note = notes[index] + 12 * octaveOffset if (!active) { instrument.stopNote(note) continue diff --git a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt index cba0063..e254674 100644 --- a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt +++ b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt @@ -17,7 +17,7 @@ val noteCount: Int, val getNotes: (Note, Array) -> Array ) { - Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0] - 24) }), + Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0]) }), Chord("Chord Notes", 3, { _, chordNotes -> chordNotes }), RootRelative("Song root relative", 12, { root, _ -> Array(12) { root + it } }), ; diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt index 57dc7ed..eb56238 100644 --- a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt +++ b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt @@ -23,6 +23,7 @@ import com.lukas.music.song.voice.Voice import com.lukas.music.util.ArrayProperty import com.lukas.music.util.EasyDialogFragment +import com.lukas.music.util.setup import com.lukas.music.util.setupToggle class EditVoiceFragment(private val voice: Voice) : EasyDialogFragment() { @@ -46,6 +47,10 @@ } binding.noteGrid.addView(rowLayout) } + binding.octaveSeekBar.setup(-4, 4, voice.octaveOffset) { + voice.octaveOffset = it + binding.octaveText.text = "octave = $it" + } binding.noteGrid.isStretchAllColumns = true binding.closeButton.setOnClickListener { dismiss() diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lukas/music/song/voice/Voice.kt b/app/src/main/java/com/lukas/music/song/voice/Voice.kt index 1408362..139be78 100644 --- a/app/src/main/java/com/lukas/music/song/voice/Voice.kt +++ b/app/src/main/java/com/lukas/music/song/voice/Voice.kt @@ -24,6 +24,8 @@ var restrikeNotes = false lateinit var noteActive: Array> + var octaveOffset = 0 + init { type = type } @@ -36,7 +38,7 @@ val activeNotes = noteActive[beatIndex] val notes = type.getNotes(root, chordNotes) for ((index, active) in activeNotes.withIndex()) { - val note = notes[index] + val note = notes[index] + 12 * octaveOffset if (!active) { instrument.stopNote(note) continue diff --git a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt index cba0063..e254674 100644 --- a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt +++ b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt @@ -17,7 +17,7 @@ val noteCount: Int, val getNotes: (Note, Array) -> Array ) { - Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0] - 24) }), + Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0]) }), Chord("Chord Notes", 3, { _, chordNotes -> chordNotes }), RootRelative("Song root relative", 12, { root, _ -> Array(12) { root + it } }), ; diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt index 57dc7ed..eb56238 100644 --- a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt +++ b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt @@ -23,6 +23,7 @@ import com.lukas.music.song.voice.Voice import com.lukas.music.util.ArrayProperty import com.lukas.music.util.EasyDialogFragment +import com.lukas.music.util.setup import com.lukas.music.util.setupToggle class EditVoiceFragment(private val voice: Voice) : EasyDialogFragment() { @@ -46,6 +47,10 @@ } binding.noteGrid.addView(rowLayout) } + binding.octaveSeekBar.setup(-4, 4, voice.octaveOffset) { + voice.octaveOffset = it + binding.octaveText.text = "octave = $it" + } binding.noteGrid.isStretchAllColumns = true binding.closeButton.setOnClickListener { dismiss() diff --git a/app/src/main/res/layout/fragment_edit_voice.xml b/app/src/main/res/layout/fragment_edit_voice.xml index ff77f1b..2225ed0 100644 --- a/app/src/main/res/layout/fragment_edit_voice.xml +++ b/app/src/main/res/layout/fragment_edit_voice.xml @@ -61,7 +61,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/restrikeButton" + app:layout_constraintTop_toBottomOf="@+id/octaveSeekBar" tools:ignore="SpeakableTextPresentCheck"> + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a41dfa..b121fe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 97ec2a0..9de986d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,4 +65,5 @@ testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'com.github.alanvan0502:segmented-control-group:v1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lukas/music/song/voice/Voice.kt b/app/src/main/java/com/lukas/music/song/voice/Voice.kt index 1408362..139be78 100644 --- a/app/src/main/java/com/lukas/music/song/voice/Voice.kt +++ b/app/src/main/java/com/lukas/music/song/voice/Voice.kt @@ -24,6 +24,8 @@ var restrikeNotes = false lateinit var noteActive: Array> + var octaveOffset = 0 + init { type = type } @@ -36,7 +38,7 @@ val activeNotes = noteActive[beatIndex] val notes = type.getNotes(root, chordNotes) for ((index, active) in activeNotes.withIndex()) { - val note = notes[index] + val note = notes[index] + 12 * octaveOffset if (!active) { instrument.stopNote(note) continue diff --git a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt index cba0063..e254674 100644 --- a/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt +++ b/app/src/main/java/com/lukas/music/song/voice/VoiceType.kt @@ -17,7 +17,7 @@ val noteCount: Int, val getNotes: (Note, Array) -> Array ) { - Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0] - 24) }), + Bass("Bass Note", 1, { _, chordNotes -> arrayOf(chordNotes[0]) }), Chord("Chord Notes", 3, { _, chordNotes -> chordNotes }), RootRelative("Song root relative", 12, { root, _ -> Array(12) { root + it } }), ; diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt index 57dc7ed..eb56238 100644 --- a/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt +++ b/app/src/main/java/com/lukas/music/ui/fragments/EditVoiceFragment.kt @@ -23,6 +23,7 @@ import com.lukas.music.song.voice.Voice import com.lukas.music.util.ArrayProperty import com.lukas.music.util.EasyDialogFragment +import com.lukas.music.util.setup import com.lukas.music.util.setupToggle class EditVoiceFragment(private val voice: Voice) : EasyDialogFragment() { @@ -46,6 +47,10 @@ } binding.noteGrid.addView(rowLayout) } + binding.octaveSeekBar.setup(-4, 4, voice.octaveOffset) { + voice.octaveOffset = it + binding.octaveText.text = "octave = $it" + } binding.noteGrid.isStretchAllColumns = true binding.closeButton.setOnClickListener { dismiss() diff --git a/app/src/main/res/layout/fragment_edit_voice.xml b/app/src/main/res/layout/fragment_edit_voice.xml index ff77f1b..2225ed0 100644 --- a/app/src/main/res/layout/fragment_edit_voice.xml +++ b/app/src/main/res/layout/fragment_edit_voice.xml @@ -61,7 +61,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/restrikeButton" + app:layout_constraintTop_toBottomOf="@+id/octaveSeekBar" tools:ignore="SpeakableTextPresentCheck"> + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 05de31e..b459d48 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,6 +13,7 @@ gradlePluginPortal() google() mavenCentral() + maven { url 'https://jitpack.io' } } } dependencyResolutionManagement { @@ -20,6 +21,7 @@ repositories { google() mavenCentral() + maven { url 'https://jitpack.io' } } } rootProject.name = "Music"