Exemplo n.º 1
0
        public override void play()
        {
            if ( !music_enabled ) return;

              if (currently_playing == this)
              {
            if (MediaPlayer.State == MediaState.Playing) return;
            if (MediaPlayer.State == MediaState.Paused)
            {
              MediaPlayer.Resume();
              return;
            }
              }

              try
              {
            MediaPlayer.Play(song);
            currently_playing = this;
            if (is_playing())
            {
              MediaPlayer.IsRepeating = repeats;
            }
              }
              catch (Exception)
              {
            // is probably plugged in on USB
              }
        }
Exemplo n.º 2
0
        public static void init( ClassNativeSound sound, ClassString filename )
        {
            String fname = filename.data;
              if (fname.EndsWith(".wav") || fname.EndsWith(".mp3") || fname.EndsWith(".m4a"))
              {
            fname = fname.Substring( 0, fname.Length - 4);
              }

              WP7Sound sound_data = null;
              try
              {
            sound_data = new WP7SoundEffect(
              Plasmacore.content.Load<SoundEffect>(fname) );
              }
              catch (Exception)
              {
            try
            {
              sound_data = new WP7Song( Plasmacore.content.Load<Song>(fname) );
            }
            catch (Exception)
            {
              Bard.log( "Sound not found: " + filename.data );
              return;
            }
              }
              sound.property_native_data = sound_data;
        }