package com.osnova;

import android.media.*;
import android.content.res.*;
import android.content.*;


public class Audio {
    
    SoundPool sop;
    MediaPlayer mp;
    AssetManager am;
    Context con;
    AssetFileDescriptor afd;
    
    
    public Audio(Context con){
       this.con=con; 
     am=con.getAssets();
        
    }
    
    
    //////////
    public SoundPool Load(String s){
        
        sop=new SoundPool(1,AudioManager.STREAM_MUSIC,0);	

		     try{
        
        AssetFileDescriptor afd=am.openFd(s);
        
         sop.load(afd,0);  
            
        }catch(Exception exe){}
   
    return sop;
    }
    //////
    
    
    public MediaPlayer LoadM(String s){
        
  
       
        try{
          
        
       afd  = am.openFd(s);
        
    } catch(Exception ee)  {}  
       
        mp=new MediaPlayer();
          
      try{
            
         mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
         mp.prepare();
             
            
        } catch(Exception ex) {}
        
        
        
      return mp;
    }
    
    
    
    
}
