mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-12 06:16:09 +10:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -48,7 +48,22 @@ class ConversationCell: UITableViewCell {
|
||||
}
|
||||
|
||||
if let latestMessage = messagesInConversation(conversation).lastObject() as? Message {
|
||||
self.chatLabel.text = latestMessage.textContent
|
||||
|
||||
switch latestMessage.mediaType {
|
||||
|
||||
case MessageMediaType.Audio.rawValue:
|
||||
self.chatLabel.text = "[声音]"
|
||||
case MessageMediaType.Video.rawValue:
|
||||
self.chatLabel.text = "[视频]"
|
||||
case MessageMediaType.Image.rawValue:
|
||||
self.chatLabel.text = "[图片]"
|
||||
case MessageMediaType.Text.rawValue:
|
||||
self.chatLabel.text = latestMessage.textContent
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
self.timeAgoLabel.text = latestMessage.createdAt.timeAgo
|
||||
} else {
|
||||
self.chatLabel.text = ""
|
||||
|
||||
+3
-17
@@ -180,20 +180,15 @@ class Waver: UIView {
|
||||
|
||||
var totalTime:CGFloat = CGFloat(waveSamples.count/(60/fps)) // 计算音频的时长
|
||||
|
||||
var bubbleWidth = -0.071*(totalTime*totalTime) + 8.532*totalTime //计算这个时长下的Bubble宽度,Bubble 的宽度和时间的关系函数是一个一元二次函数
|
||||
var bubbleWidth = -0.05*(totalTime*totalTime) + 6.0*totalTime + 50.0 //计算这个时长下的Bubble宽度,Bubble 的宽度和时间的关系函数是一个一元二次函数
|
||||
|
||||
var effectiveSample = bubbleWidth/(waveSquareWidth+waveGap) < 1 ? 1 : bubbleWidth/(waveSquareWidth+waveGap) //计算这个长度里实际可以放多少个sample图形
|
||||
if (effectiveSample > 10) {
|
||||
|
||||
}
|
||||
var effectiveSample = bubbleWidth/(waveSquareWidth+waveGap) < 1 ? 1 : bubbleWidth/(waveSquareWidth+waveGap) //计算这个长度里实际可以放多少个sample
|
||||
|
||||
var sampleGap = Int(CGFloat(samplesCount)/effectiveSample) //计算按照实际可放的sample数量,原sample需要每几个合并一次
|
||||
|
||||
var timePerSample = totalTime/(CGFloat(samplesCount)/effectiveSample) //计算合并后每个 sample 需要经过多少时间播放
|
||||
|
||||
|
||||
|
||||
println("samplesCount \(samplesCount) totalTime \(totalTime) bubbleWidth \(bubbleWidth) effectiveSample\(effectiveSample) sampleGap \(sampleGap) timePerSample\(timePerSample)")
|
||||
println("samplesCount \(samplesCount) totalTime \(totalTime) bubbleWidth \(bubbleWidth) effectiveSample \(effectiveSample) sampleGap \(sampleGap) timePerSample\(timePerSample)")
|
||||
|
||||
//
|
||||
|
||||
@@ -214,15 +209,6 @@ class Waver: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
if (finalSamples.count < 10){
|
||||
|
||||
finalSamples = [Float]()
|
||||
|
||||
for sample in waveSamples {
|
||||
finalSamples.append(Float(sample))
|
||||
}
|
||||
}
|
||||
|
||||
println("Final Sample is \(finalSamples)")
|
||||
|
||||
return finalSamples
|
||||
|
||||
Reference in New Issue
Block a user