我从我的网络接收 xy 数据,我想在 Wayland 上使用 linux 控制鼠标位置。
我见过很多使用 X 库或 X 应用程序的源代码,但它在 Wayland 上不起作用。我也查看了 libinput 和 evedev,但我没有找到任何关于如何创建/模拟鼠标的代码示例。
我有一个声音文件(.3gp),大概约1分钟.我想每1/4秒获得一次这个声音文件的频率.我的想法是每隔1/4秒从音频文件接收采样并使用FFT我可能得到频率值.有没有办法做到这一点?
实际上我会将声音文件分成1/4sec样本声音文件(alwyas覆盖这些声音文件),然后使用FFT算法并检测magintude最大的频率.但是可能有更简单的解决方案,但我也不知道如何做到这一点.
***更新2 - 新代码
到目前为止我使用此代码:
public class RecordAudio extends AsyncTask<Void, double[], Void> {
@Override
protected Void doInBackground(Void... arg0) {
try {
int bufferSize = AudioRecord.getMinBufferSize(frequency,
AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
//int bufferSize = AudioRecord.getMinBufferSize(frequency,
// channelConfiguration, audioEncoding);
AudioRecord audioRecord = new AudioRecord(
MediaRecorder.AudioSource.MIC, frequency,
channelConfiguration, audioEncoding, bufferSize);
short[] buffer = new short[blockSize];
//double[] toTransform = new double[blockSize];
audioRecord.startRecording();
// started = true; hopes this should true before calling
// following while loop
while (started) {
sampling++;
double[] re = new double[blockSize];
double[] …Run Code Online (Sandbox Code Playgroud) 我只是试着运行这个:
int main(int argc, char **argv) {
EGLDisplay display;
EGLConfig config;
EGLContext context;
EGLint num_config;
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY)
{
std:: cout << "ERROR: EGL could not be initialized"<< std::endl;
exit(EXIT_FAILURE);
}
if (!eglInitialize(display, nullptr, nullptr))
{
std:: cout << "ERROR: Could not start EGL display connection"<< std::endl;
exit(EXIT_FAILURE);
}
if (eglChooseConfig(display, nullptr, &config, 1, &num_config) != EGL_TRUE)
{
std:: cout << "ERROR: Configuration selection failed" << std::endl;
exit(EXIT_FAILURE);
}
eglBindAPI(EGL_OPENGL_API);
context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL); …Run Code Online (Sandbox Code Playgroud) 我正在为我的 GUI 使用 qss 样式表。它工作得很好,但我想为我的自定义小部件定义不同的样式表。例如,QPushbutton的样式效果很好,但我想应用不同的样式MyQPushButton(从 QPushButton 扩展)。
我尝试过这样的事情:
MyQPushButton
{
color: #dcdcdc;
// some code here
}
QPushButton
{
color: #b1b1b1;
// some code here
}
Run Code Online (Sandbox Code Playgroud)
不过QPushButton的风格已经被应用了MyQPushButton。如何覆盖这种行为?