Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
doc/_site/
*.tgz
extract/
flutter_sound/example/macos/Flutter/GeneratedPluginRegistrant.swift
flutter_sound_platform_interface/.dart_tool/package_config.json
flutter_sound_platform_interface/.dart_tool/package_config_subset
flutter_sound_web/.dart_tool/package_config.json
flutter_sound_web/.dart_tool/package_config_subset

4 changes: 2 additions & 2 deletions flutter_sound/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ dependencies {
// -------------------------------------------------------------------------------------
// CAUTION: The following instruction is for developping and debugging the Flauto Engine
// DO NOT INCLUDE THE FOLLOWING LINE IN A REAL APP !!!
//implementation project(':flutter_sound_core')
implementation 'com.github.canardoux:flutter_sound_core:9.2.13'
implementation project(':flutter_sound_core')
// implementation 'com.github.canardoux:flutter_sound_core:9.2.13'
// -------------------------------------------------------------------------------------

}
Expand Down
2 changes: 2 additions & 0 deletions flutter_sound/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ rootProject.name = 'flutter_sound'
// CAUTION: The following instruction is for developping and debugging the Flauto Engine
// DO NOT INCLUDE THE FOLLOWING LINES IN A REAL APP !!!
//project(':flutter_sound_core').projectDir = file('../../flutter_sound_core/android')
include(':flutter_sound_core')
project(':flutter_sound_core').projectDir = file('../../flutter_sound_core/android')
// -------------------------------------------------------------------------------------

Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,46 @@ void getResourcePath ( final MethodCall call, final Result result )

}

//--------------------------- EQ related ------------------------------//

void getAudioSessionId(final MethodCall call, final Result result) throws Exception {
result.success (m_flautoPlayer.getAudioSessionId());
}

void initEqualizer(final MethodCall call, final Result result) throws Exception {
m_flautoPlayer.initEqualizer(call.argument("sessionId"));
result.success ( getPlayerState());
}

void setAudioSessionId(final MethodCall call, final Result result) {
m_flautoPlayer.setAudioSessionId(call.argument("sessionId"));
result.success ( getPlayerState());
}

void equalizerBandSetGain(final MethodCall call, final Result result) {
m_flautoPlayer.equalizerBandSetGain(call.argument("bandIndex"),
call.argument("gain"));
result.success (new HashMap<String, Object>());
}

void audioEffectSetEnabled(final MethodCall call, final Result result) {
m_flautoPlayer.audioEffectSetEnabled(call.argument("type"),
call.argument("enabled"));
result.success (new HashMap<String, Object>());
}

void equalizerAudioEffectGetParameters(final MethodCall call, final Result result) {
result.success ( m_flautoPlayer.equalizerAudioEffectGetParameters());
}




void getPlayerState ( final MethodCall call, final Result result )
{
result.success (getPlayerState());
}


public void setLogLevel (final MethodCall call, final MethodChannel.Result result )
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ public void onMethodCall ( final MethodCall call, final Result result )
}
break;

case "getAudioSessionId":
{
try {
aPlayer.getAudioSessionId ( call, result );
} catch (Exception e) {
e.printStackTrace();
}
}
break;

case "closePlayer":
{
aPlayer.closePlayer ( call, result );
Expand All @@ -106,7 +116,6 @@ public void onMethodCall ( final MethodCall call, final Result result )
break;



case "getProgress":
{
aPlayer.getProgress ( call, result );
Expand Down Expand Up @@ -169,6 +178,56 @@ public void onMethodCall ( final MethodCall call, final Result result )
}
break;

case "initAndroidEqualizer":
{
try{
aPlayer.initEqualizer(call, result);
} catch (Exception e) {
e.printStackTrace();
}
}
break;

case "setAudioSessionId":
{
try{
aPlayer.setAudioSessionId(call, result);
} catch (Exception e) {
e.printStackTrace();
}
}
break;

case "androidEqualizerBandSetGain":
{
try{
aPlayer.equalizerBandSetGain(call, result);
} catch (Exception e) {
e.printStackTrace();
}
}
break;

case "audioEffectSetEnabled":
{
try{
aPlayer.audioEffectSetEnabled(call, result);
} catch (Exception e) {
e.printStackTrace();
}
}
break;

case "androidEqualizerGetParameters":
{
try{
aPlayer.equalizerAudioEffectGetParameters(call, result);
} catch (Exception e) {
e.printStackTrace();
}
}
break;


case "feed":
{
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions flutter_sound/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ dependencies:
#flutter_ffmpeg: ^0.3.1
intl: ^0.17.0
just_audio: ^0.9.11
audio_session: ^0.1.6



dev_dependencies:
Expand Down
1 change: 0 additions & 1 deletion flutter_sound/ios/Classes/FlutterSoundManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ - (void) resetPlugin: (FlutterMethodCall*)call result: (FlutterResult)result
{
if ( flautoPlayerSlots[i] != [NSNull null] )
{
NSLog (@"iOS: resetPlugin");
Session* session = flautoPlayerSlots[i];
[ session reset: call result: result];
}
Expand Down
2 changes: 2 additions & 0 deletions flutter_sound/ios/Classes/FlutterSoundPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
- (void)stopPlayer:(FlutterMethodCall*)call result:(FlutterResult)result;
- (void)feed:(FlutterMethodCall*)call result: (FlutterResult)result;
- (void)setLogLevel: (FlutterMethodCall*)call result: (FlutterResult)result;
- (void)enableEqualizer: (FlutterMethodCall*)call result: (FlutterResult)result;
- (void)darwinEqualizerBandSetGain: (FlutterMethodCall*)call result: (FlutterResult)result;

@end

Expand Down
45 changes: 36 additions & 9 deletions flutter_sound/ios/Classes/FlutterSoundPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,50 @@ - (void)skipBackward
// BE CAREFUL : TrackPlayer must instance FlautoTrackPlayer !!!!!
- (FlutterSoundPlayer*)init: (FlutterMethodCall*)call playerManager: (FlutterSoundPlayerManager*)pm
{
flautoPlayer = [ [FlautoPlayer alloc] init: self];
flutterSoundPlayerManager = pm;
bool voiceProcessing = (bool)call.arguments[@"voiceProcessing"];
[flautoPlayer setVoiceProcessing: voiceProcessing];
return [super init: call]; // Init Session
flautoPlayer = [ [FlautoPlayer alloc] init: self];
flutterSoundPlayerManager = pm;

bool voiceProcessing = (bool)call.arguments[@"voiceProcessing"];
[flautoPlayer setVoiceProcessing: voiceProcessing];


// Init EQ
NSDictionary *arguments = call.arguments[@"equalizerParams"];
if (arguments != nil)
{
[flautoPlayer initEqualizer: arguments];
}


return [super init: call]; // Init Session
}

- (void)setPlayerManager: (FlutterSoundPlayerManager*)pm
{
flutterSoundPlayerManager = pm;
}

- (void)enableEqualizer: (FlutterMethodCall*)call result: (FlutterResult)result
{
[self log: DBG msg: @"IOS:--> enableEqualizer"];
BOOL enabled = [[call.arguments objectForKey:@"enabled"] boolValue];
[flautoPlayer enableEqualizer: enabled];
NSNumber* status = [self getPlayerStatus];
result(status);
[self log: DBG msg: @"IOS:<-- enableEqualizer"];
}

- (void)darwinEqualizerBandSetGain: (FlutterMethodCall*)call result: (FlutterResult)result
{
[self log: DBG msg: @"IOS:--> darwinEqualizerBandSetGain"];
int index = [[call.arguments objectForKey:@"bandIndex"] intValue];
float gain = [[call.arguments objectForKey:@"gain"] floatValue];
[flautoPlayer setEqualizerBandGain: index gain: gain];
NSNumber* status = [self getPlayerStatus];
result(status);
[self log: DBG msg: @"IOS:<-- darwinEqualizerBandSetGain"];
}

//- (FlutterSoundPlayer*) init
//{
// return [super init];
//}

- (void)isDecoderSupported:(t_CODEC)codec result: (FlutterResult)result
{
Expand Down
15 changes: 11 additions & 4 deletions flutter_sound/ios/Classes/FlutterSoundPlayerManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,20 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result
}

FlutterSoundPlayer* aFlautoPlayer = (FlutterSoundPlayer*)[ self getSession: call];


if ([@"enableEqualizer" isEqualToString: call.method])
{
[aFlautoPlayer enableEqualizer: call result: result];
} else

if ([@"darwinEqualizerBandSetGain" isEqualToString: call.method])
{
[aFlautoPlayer darwinEqualizerBandSetGain: call result: result];
} else

if ([@"openPlayer" isEqualToString:call.method])
{
aFlautoPlayer = [[FlutterSoundPlayer alloc] init: call playerManager: self];
//[aFlautoPlayer setPlayerManager: self];

[aFlautoPlayer openPlayer: call result: result];
} else

Expand Down Expand Up @@ -185,7 +193,6 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result
[aFlautoPlayer setLogLevel: call result: result];
} else


{
result(FlutterMethodNotImplemented);
}
Expand Down
4 changes: 2 additions & 2 deletions flutter_sound/ios/flutter_sound.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
Pod::Spec.new do |s|
s.name = 'flutter_sound'
s.version = '9.2.13'
s.version = '9.2.14'
s.summary = 'Flutter plugin that relates to sound like audio and recorder.'
s.description = <<-DESC
Flutter plugin that relates to sound like audio and recorder.
Expand All @@ -18,5 +18,5 @@ Flutter plugin that relates to sound like audio and recorder.

s.ios.deployment_target = '10.0'
s.static_framework = true
s.dependency 'flutter_sound_core', '9.2.13'
s.dependency 'flutter_sound_core'
end
7 changes: 7 additions & 0 deletions flutter_sound/lib/flutter_sound.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
library everything;

export 'package:flutter_sound_platform_interface/flutter_sound_platform_interface.dart';
export 'package:flutter_sound_platform_interface/equalizer/platform_interface.dart';

/// Main
///library tau;
Expand All @@ -52,3 +53,9 @@ export 'public/tau.dart';
///
///library util;
export 'public/util/flutter_sound_helper.dart';

/// Equalizer
export 'public/equalizer/android_equalizer.dart';
// export 'public/equalizer/equalizer.dart';
// export 'public/equalizer/platform_interface.dart';
export 'public/equalizer/darwin_equalizer.dart';
Loading