my own oboe
This commit is contained in:
parent
9c532c507b
commit
ca0137b228
@ -39,7 +39,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.carriez.flutter_hbb"
|
applicationId "com.carriez.flutter_hbb"
|
||||||
minSdkVersion 18
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:flutter_sound/flutter_sound.dart';
|
|
||||||
import 'package:device_info/device_info.dart';
|
import 'package:device_info/device_info.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
@ -33,7 +32,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
bool _waitForImage;
|
bool _waitForImage;
|
||||||
bool _initialized = false;
|
bool _initialized = false;
|
||||||
final _permissions = Map<String, bool>();
|
final _permissions = Map<String, bool>();
|
||||||
final _audioPlayer = FlutterSoundPlayer();
|
|
||||||
|
|
||||||
get permissions => _permissions;
|
get permissions => _permissions;
|
||||||
get initialized => _initialized;
|
get initialized => _initialized;
|
||||||
@ -66,13 +64,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
_permissions.clear();
|
_permissions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> stopAudio() async {
|
|
||||||
final st = await _audioPlayer.getPlayerState();
|
|
||||||
if (st != PlayerState.isPlaying) return;
|
|
||||||
await _audioPlayer.stopPlayer();
|
|
||||||
await _audioPlayer.closeAudioSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
void update(
|
void update(
|
||||||
String id,
|
String id,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
@ -97,23 +88,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
pos = evt;
|
pos = evt;
|
||||||
} else if (name == 'permission') {
|
} else if (name == 'permission') {
|
||||||
FFI.ffiModel.updatePermission(evt);
|
FFI.ffiModel.updatePermission(evt);
|
||||||
} else if (name == "audio_format") {
|
|
||||||
() async {
|
|
||||||
try {
|
|
||||||
/*
|
|
||||||
var s = int.parse(evt['sample_rate']);
|
|
||||||
// var c = int.parse(evt['channels']);
|
|
||||||
// Flutter Sound does not support Floating Point PCM data, nor records with more that one audio channel.
|
|
||||||
// On Flutter Sound, Raw PCM is only PCM INT-Linerar 16 monophony
|
|
||||||
await stopAudio();
|
|
||||||
await _audioPlayer.openAudioSession();
|
|
||||||
await _audioPlayer.startPlayerFromStream(
|
|
||||||
codec: Codec.pcm16, numChannels: 1, sampleRate: s);
|
|
||||||
*/
|
|
||||||
} catch (e) {
|
|
||||||
print('audio_format: $e');
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pos != null) FFI.cursorModel.updateCursorPosition(pos);
|
if (pos != null) FFI.cursorModel.updateCursorPosition(pos);
|
||||||
@ -139,21 +113,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var frame = FFI._getAudio();
|
|
||||||
if (frame != null && frame != nullptr) {
|
|
||||||
() async {
|
|
||||||
try {
|
|
||||||
/*
|
|
||||||
final ref = frame.ref;
|
|
||||||
final bytes = Uint8List.sublistView(ref.data.asTypedList(ref.len));
|
|
||||||
await _audioPlayer.feedFromStream(bytes);
|
|
||||||
*/
|
|
||||||
} catch (e) {
|
|
||||||
print('play audio frame: $e');
|
|
||||||
}
|
|
||||||
FFI._freeRgba(frame);
|
|
||||||
}();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSwitchDisplay(Map<String, dynamic> evt) {
|
void handleSwitchDisplay(Map<String, dynamic> evt) {
|
||||||
@ -453,7 +412,6 @@ class FFI {
|
|||||||
static F3 _setByName;
|
static F3 _setByName;
|
||||||
static F4 _freeRgba;
|
static F4 _freeRgba;
|
||||||
static F5 _getRgba;
|
static F5 _getRgba;
|
||||||
static F5 _getAudio;
|
|
||||||
static Pointer<RgbaFrame> _lastRgbaFrame;
|
static Pointer<RgbaFrame> _lastRgbaFrame;
|
||||||
static var shift = false;
|
static var shift = false;
|
||||||
static var ctrl = false;
|
static var ctrl = false;
|
||||||
@ -595,7 +553,6 @@ class FFI {
|
|||||||
_freeRgba = dylib
|
_freeRgba = dylib
|
||||||
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
|
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
|
||||||
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
|
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
|
||||||
_getAudio = dylib.lookupFunction<F5, F5>('get_audio');
|
|
||||||
_dir = (await getApplicationDocumentsDirectory()).path;
|
_dir = (await getApplicationDocumentsDirectory()).path;
|
||||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
|
@ -34,7 +34,6 @@ dependencies:
|
|||||||
flutter_easyloading: ^2.1.3
|
flutter_easyloading: ^2.1.3
|
||||||
tuple: ^1.0.1
|
tuple: ^1.0.1
|
||||||
wakelock: ^0.2.1+1
|
wakelock: ^0.2.1+1
|
||||||
flutter_sound: ^6.4.2+1
|
|
||||||
device_info: ^1.0.0
|
device_info: ^1.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user