Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Windows Media Audio compressor

, 8 Apr 2004
Managed C++ Windows Media Audio (WMA) compressor.
//
//
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
//  PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
//  REMAINS UNCHANGED.
//
//  Email:  yetiicb@hotmail.com
//
//  Copyright (C) 2002-2003 Idael Cardoso. 
//

using System;
using System.IO;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Windows.Forms;
using WaveLib;

namespace Yeti.MMedia
{
	
  /// <summary>
  /// 
  /// </summary>
  [Serializable]
  public class AudioWriterConfig : ISerializable
  {
    protected WaveFormat m_Format;

    /// <summary>
    /// A constructor with this signature must be implemented by descendants. 
    /// <see cref="System.Runtime.Serialization.ISerializable"/> for more information
    /// </summary>
    /// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> where is the serialized data.</param>
    /// <param name="context">The source (see <see cref="System.Runtime.Serialization.StreamingContext"/>) for this serialization.</param>
    protected AudioWriterConfig(SerializationInfo info, StreamingContext context)
    {
      int rate = info.GetInt32("Format.Rate");
      int bits = info.GetInt32("Format.Bits");
      int channels = info.GetInt32("Format.Channels");
      m_Format = new WaveFormat(rate, bits, channels);
    }

    public AudioWriterConfig(WaveFormat f)
    {
      m_Format = new WaveFormat(f.nSamplesPerSec, f.wBitsPerSample, f.nChannels);
    }

    public AudioWriterConfig()
      :this(new WaveFormat(44100, 16, 2))
    {
    }

    public WaveFormat Format
    {
      get
      {
        return m_Format;
      }
      set
      {
        m_Format = value;
      }
    }

    #region ISerializable Members

    public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
    {
      info.AddValue("Format.Rate", m_Format.nSamplesPerSec);
      info.AddValue("Format.Bits", m_Format.wBitsPerSample);
      info.AddValue("Format.Channels", m_Format.nChannels);
    }

    #endregion
  }
  
  public interface IConfigControl
  {
    void DoApply();
    void DoSetInitialValues();
    /// <summary>
    /// Implementors must set [Browsable(false)] attribute to this property
    /// </summary>
    Control ConfigControl { get; }
    /// <summary>
    /// Implementors must set [Browsable(false)] attribute to this property
    /// </summary>
    string ControlName { get; }
    event EventHandler ConfigChange;
  }

  public interface IEditAudioWriterConfig : IConfigControl
	{
    /// <summary>
    /// Implementors must set [Browsable(false)] attribute to this property
    /// </summary>
    AudioWriterConfig Config { get; set; }
	}

  public interface IEditFormat : IConfigControl
  {
    [Browsable(false)]
    WaveFormat Format { get; set; }
  }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Idael Cardoso
Web Developer
France France
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 9 Apr 2004
Article Copyright 2004 by Idael Cardoso
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid