就命名而言,我还是觉得 byte short int long 这样的命名方式好一些的,唯一的例外是 Rust 那样 i8 u32 的命名方式,CLR 和 Qt 这种 uint8 真的会让非英语母语的人很困扰的。
我讨厌把非关键的东西写长,一个字符也不行,所以我用 C++ 的 using(typedef) 给 Qt 的 core primitives 都起了 Rust 式别名
利用
shuf 弄混这些项目:#include <QTimer>解析器不成熟,所以不能有空行。真是浪费时间
#include <QIODevice>
#include <QScopedPointer>
#include <QByteArray>
#include <QLabel>
#include <QSlider>
#include <QAudioOutput>
#include <QMainWindow>
#include <QPushButton>
#include <QComboBox>
#include <QObject>
可悲的我终于又记起来了 print() 后直接退出程序不会刷新 stdout buffer 的。
不对,是我的 histogram 程序写错了,我还以为我记得住,不对是成功理解了的,真是令人悲伤的故事。
不对,是我的 histogram 程序写错了,我还以为我记得住,不对是成功理解了的,真是令人悲伤的故事。
[QTimer, QIODevice, QScopedPointer, QByteArray, QLabel, QSlider, QAudioOutput, QMainWindow, QPushButton, QComboBox, QObject]
QIODevice
QTimer
QAudioOutput
QObject
QScopedPointer
QByteArray
QMainWindow
QLabel
QComboBox
QPushButton
QSlider
修好 bug 后,本苏又觉得自己行了。
// audio: channel * sample
// sample: rate(sample pre sec) / size(bit size)
typealias Real = Double
typealias Sample = Double
abstract class SampleIterator: DoubleIterator {
final override fun hasNext() = true
final override fun nextDouble() = nextSample()
abstract fun nextSample(): Sample
}
typealias IndexedSampler = (Int) -> Sample
open class Wave(private val y: IndexedSampler): SampleIterator {
private var x = 0
override fun nextDouble() = y(x++)
}
open class RepeatWave(y: IndexedSampler, private val cycle: Real)
: Wave({ y(it) * cycle * ((i%cycle) /cycle) }) /*cycle realdiv (i%cycle)*/
object SinWave: RepeatWave({ sin(2*PI*it) }) 现在正在写
writeBytes("RIFF")
writeBytes("fmt")
writeShort(1); //format=PCM
writeShort(1); //channels
writeInt(_441kHz); //samples per sec
writeInt(_441kHz*1*(16/Byte.SIZE_BITS)); //byte rate
writeShort(1*(16/Byte.SIZE_BITS)); //block align
writeShort(16); //sample size=16
writeShort(0) //extend area
受不了了,这种东西明明应该由 org.duangsuse.bin 来处理。