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.Windows.Forms;
using WaveLib;

namespace Yeti.MMedia
{
  public abstract class AudioWriter : BinaryWriter
  {
    protected WaveFormat m_InputDataFormat;

    public AudioWriter(Stream Output, WaveFormat InputDataFormat)
      :base(Output, System.Text.Encoding.ASCII)
    {
      m_InputDataFormat = InputDataFormat;
    }

    
    public AudioWriter(Stream Output, AudioWriterConfig Config)
      :this(Output, Config.Format)
    {
    }

    
    protected abstract int GetOptimalBufferSize();

    private static int m_ConfigWidth = 368;
    private static int m_ConfigHeight = 264;

    protected virtual AudioWriterConfig GetWriterConfig()
    {
      return new AudioWriterConfig(m_InputDataFormat);
    }

    public AudioWriterConfig WriterConfig
    {
      get
      {
        return GetWriterConfig();
      }
    }

    /// <summary>
    /// Width of the config control
    /// </summary>
    public static int ConfigWidth
    {
      get
      {
        return m_ConfigWidth;
      }
      set
      {
        m_ConfigWidth = value;
      }
    }

    /// <summary>
    /// Height of the config control
    /// </summary>
    public static int ConfigHeight
    {
      get 
      {
        return m_ConfigHeight;
      }
      set
      {
        m_ConfigHeight = value;
      }
    }

    /// <summary>
    /// Optimal size of the buffer used in each write operation to obtain best performance.
    /// This value must be greater than 0 
    /// </summary>
    public int OptimalBufferSize
    {
      get
      {
        return GetOptimalBufferSize();
      }
    }
    
    public override void Write(string value)
    {
      throw new NotSupportedException("Write(string value) is not supported");
    }
  
    public override void Write(float value)
    {
      throw new NotSupportedException("Write(float value) is not supported");
    }
  
    public override void Write(ulong value)
    {
      throw new NotSupportedException("Write(ulong value) is not supported");
    }
  
    public override void Write(long value)
    {
      throw new NotSupportedException("Write(long value) is not supported");
    }
  
    public override void Write(uint value)
    {
      throw new NotSupportedException("Write(uint value) is not supported");
    }
  
    public override void Write(int value)
    {
      throw new NotSupportedException("Write(int value) is not supported");
    }
  
    public override void Write(ushort value)
    {
      throw new NotSupportedException("Write(ushort value) is not supported");
    }
  
    public override void Write(short value)
    {
      throw new NotSupportedException("Write(short value) is not supported");
    }
  
    public override void Write(decimal value)
    {
      throw new NotSupportedException("Write(decimal value) is not supported");
    }
  
    public override void Write(double value)
    {
      throw new NotSupportedException("Write(double value) is not supported");
    }
  
    public override void Write(char[] chars, int index, int count)
    {
      throw new NotSupportedException("Write(char[] chars, int index, int count) is not supported");
    }
  
    public override void Write(char[] chars)
    {
      throw new NotSupportedException("Write(char[] chars) is not supported");
    }
  
    public override void Write(char ch)
    {
      throw new NotSupportedException("Write(char ch) is not supported");
    }
  
    public override void Write(sbyte value)
    {
      throw new NotSupportedException("Write(sbyte value) is not supported");
    }
  
    public override void Write(byte value)
    {
      throw new NotSupportedException("Write(byte value) is not supported");
    }
  
    public override void Write(bool value)
    {
      throw new NotSupportedException("Write(bool value) is not supported");
    }
  }
}

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
Web03 | 2.8.150129.1 | Last Updated 9 Apr 2004
Article Copyright 2004 by Idael Cardoso
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid