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

[FEAT/#67] bpm별 음악 재생 추가 & 비트 비동기 연결 #69

Merged
merged 10 commits into from
Sep 23, 2024

Conversation

Marchbreeze
Copy link
Member

⛳️ Work Description

    1. MediaPlayer는 긴 음악에는 좋지만 loop를 하면 딜레이가 존재함
    1. SoundPool은 빠르게 실행되어 loop가 자연스럽지만, 긴 음악 재생이 안됨
    1. 결과 -> 비트랑 음악을 따로 구현한 후, awaitAll로 병렬적으로 비동기 처리해두었다 !

📸 Screenshot

KakaoTalk_Video_2024-09-24-02-21-34.mp4

Comment on lines +118 to +121
listOf(
async { playOrResumeSoundPool() },
async { mediaPlayer.start() }
).awaitAll()
Copy link
Member

Choose a reason for hiding this comment

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

님 개쩐다

Comment on lines +282 to +290
lifecycleScope.launch {
beatStream = 0
listOf(
async { setSoundPoolAsync() },
async { setMediaPlayerAsync() }
).awaitAll()
isLoaded = true
setLoadingView(false)
}
Copy link
Member

Choose a reason for hiding this comment

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

이 코드 중복이 좀 많은거 같은디 묶을수 잇나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

놀랍게도 생긴건 비슷하지만 모두 다른 ,,,


@AndroidEntryPoint
class StretchFragment : BaseFragment<FragmentStretchBinding>(R.layout.fragment_stretch) {

private val viewModel by activityViewModels<RhythmViewModel>()
private lateinit var soundPool: SoundPool
Copy link
Member

Choose a reason for hiding this comment

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

이거 fragment 둘다 있는거 같은데 activity에 하나 놔두고 공용으로 써도 될듯?

Copy link
Member Author

Choose a reason for hiding this comment

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

음악 재생기를 하나로 합쳤다가는 ,,, 무시무시한 오류들을 맛보게 될 것 같아서 ,,,, 일단 두겠읍니다

@@ -23,7 +23,7 @@

<string name="rhythm_tv_bit">%d비트</string>
<string name="rhythm_tv_bpm">%dbpm</string>
<string name="rhythm_tv_step">%d걸음</string>
<string name="rhythm_tv_step">%03d걸음</string>
Copy link
Member

Choose a reason for hiding this comment

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

이게 1이면 001로 뜨게 하는거죠?
만약에 1000들어오면 어떻게 됐었죠? 가물가물

Copy link
Member Author

Choose a reason for hiding this comment

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

%03d은 최소 3자리라 잘 출력됨니당 ~~

Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

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

잘하네요~

@Marchbreeze Marchbreeze merged commit 730fa45 into develop Sep 23, 2024
1 check passed
setDataSource(
File(requireContext().filesDir, viewModel.filename).absolutePath
)
mediaPlayer = MediaPlayer.create(requireContext(), findMusicByBpm(viewModel.bpm)).apply {
Copy link
Member

Choose a reason for hiding this comment

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

상호쌤 마이그레이션 부탁해요~

Copy link
Member

Choose a reason for hiding this comment

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

exoplayer관련 링크

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] bpm별 음악 재생 추가
2 participants