OrionAudioManager.smali

.class public Lcom/sdk/orion/lib/history/OrionAudioManager;
.super Ljava/lang/Object;


# static fields
.field private static mCurrentPath:Ljava/lang/String;


# instance fields
.field private mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;


# direct methods
.method public constructor <init>()V
    .registers 3

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    invoke-virtual {p0}, Lcom/sdk/orion/lib/history/OrionAudioManager;->getAudioParam()Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;

    move-result-object v0

    invoke-static {}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->getInstance()Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    move-result-object v1

    iput-object v1, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    iget-object v1, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v1, v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->setAudioParam(Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;)V

    return-void
.end method

.method private getPCMData(Ljava/lang/String;)[B
    .registers 8

    const/4 v1, 0x0

    if-eqz p1, :cond_9

    invoke-virtual {p1}, Ljava/lang/String;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_b

    :cond_9
    move-object v0, v1

    :goto_a
    return-object v0

    :cond_b
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    :try_start_10
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, v0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_15
    .catch Ljava/io/FileNotFoundException; {:try_start_10 .. :try_end_15} :catch_28

    invoke-virtual {v0}, Ljava/io/File;->length()J

    move-result-wide v4

    long-to-int v0, v4

    new-array v0, v0, [B

    :try_start_1c
    invoke-virtual {v2, v0}, Ljava/io/FileInputStream;->read([B)I
    :try_end_1f
    .catch Ljava/io/IOException; {:try_start_1c .. :try_end_1f} :catch_2e
    .catchall {:try_start_1c .. :try_end_1f} :catchall_3c

    :try_start_1f
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_22
    .catch Ljava/io/IOException; {:try_start_1f .. :try_end_22} :catch_23

    goto :goto_a

    :catch_23
    move-exception v1

    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_a

    :catch_28
    move-exception v0

    invoke-virtual {v0}, Ljava/io/FileNotFoundException;->printStackTrace()V

    move-object v0, v1

    goto :goto_a

    :catch_2e
    move-exception v0

    :try_start_2f
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
    :try_end_32
    .catchall {:try_start_2f .. :try_end_32} :catchall_3c

    :try_start_32
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_35
    .catch Ljava/io/IOException; {:try_start_32 .. :try_end_35} :catch_37

    :goto_35
    move-object v0, v1

    goto :goto_a

    :catch_37
    move-exception v0

    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_35

    :catchall_3c
    move-exception v0

    :try_start_3d
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_40
    .catch Ljava/io/IOException; {:try_start_3d .. :try_end_40} :catch_41

    :goto_40
    throw v0

    :catch_41
    move-exception v1

    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_40
.end method


# virtual methods
.method public getAudioParam()Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;
    .registers 3

    new-instance v0, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;

    invoke-direct {v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;-><init>()V

    const/16 v1, 0x1f40

    iput v1, v0, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;->mFrequency:I

    const/16 v1, 0xc

    iput v1, v0, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;->mChannel:I

    const/4 v1, 0x2

    iput v1, v0, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioParam;->mSampBit:I

    return-object v0
.end method

.method public playVoice(Ljava/lang/String;Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer$AudioPlayListener;)V
    .registers 5
    .param p2    # Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer$AudioPlayListener;
        .annotation build Landroid/support/annotation/Nullable;
        .end annotation
    .end param

    :try_start_0
    sget-object v0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mCurrentPath:Ljava/lang/String;

    if-eqz v0, :cond_16

    sget-object v0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mCurrentPath:Ljava/lang/String;

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_16

    iget-object v0, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->stop()Z

    iget-object v0, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->release()Z

    :cond_16
    invoke-direct {p0, p1}, Lcom/sdk/orion/lib/history/OrionAudioManager;->getPCMData(Ljava/lang/String;)[B

    move-result-object v0

    if-nez v0, :cond_1d

    :goto_1c
    return-void

    :cond_1d
    iget-object v1, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v1, p2}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->setListener(Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer$AudioPlayListener;)V

    iget-object v1, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v1, v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->setDataSource([B)V

    iget-object v0, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->prepare()Z

    iget-object v0, p0, Lcom/sdk/orion/lib/history/OrionAudioManager;->mOrionAudioPlayer:Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;

    invoke-virtual {v0}, Lcom/sdk/orion/lib/history/widgets/audioplay/OrionAudioPlayer;->play()Z

    sput-object p1, Lcom/sdk/orion/lib/history/OrionAudioManager;->mCurrentPath:Ljava/lang/String;
    :try_end_33
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_33} :catch_34

    goto :goto_1c

    :catch_34
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1c
.end method