Click here to Skip to main content
15,891,136 members
Articles / Programming Languages / Visual Basic

Windows Media Audio compressor

Rate me:
Please Sign up or sign in to vote.
4.76/5 (25 votes)
8 Apr 20045 min read 303.1K   5K   106  
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-2004 Idael Cardoso. 
//
#pragma once

#pragma unmanaged
#include "consts.h"
#include "Profile.h"
#include "ProfileManager.h"
#pragma managed

using namespace System;
using namespace System::Runtime::InteropServices;
using namespace System::Runtime::Serialization;



namespace Yeti
{
  namespace MMedia
  {
    namespace Wmf
    {
      [Serializable]
      public __gc class WmaWriterProfile : public ISerializable
      {
      protected:
        Guid m_Id;
        String* m_Name;
        String* m_ProfileData;
        String* m_Desc;
        void LoadProfile(Guid ID);
        void LoadProfile(String* ProfileData);
        WmaWriterProfile(SerializationInfo* info, StreamingContext context);
      public:
        WmaWriterProfile();
        WmaWriterProfile(Guid ID);
        WmaWriterProfile(String* ProfileData);
        
        virtual String* ToString()
        {
          return m_Name;
        }

        // ISerializable
        virtual void GetObjectData(SerializationInfo* info, StreamingContext context);

        __property String* get_Name()
        {
          return m_Name;
        }
        __property Guid get_Id()
        {
          return m_Id;
        }
        __property String* get_Description()
        {
          return m_Desc;
        }
        __property String* get_ProfileData()
        {
          return m_ProfileData;
        }
        __property CProfile* get_pProfile();
      };

      __gc __sealed class ProfileManager : public IDisposable
      {
      private:
        CProfileManager* m_pProfileManager;
      public:
        ProfileManager();

        virtual ~ProfileManager()
        {
          Dispose(false);
        }
        __property CProfileManager* get_pProfileMager()
        {
          return m_pProfileManager;
        }

        void Dispose(void)
        {
          Dispose(true);
        }
      protected:

        void Dispose(bool disposing)
        {
          if ( m_pProfileManager != NULL )
          {
            delete m_pProfileManager;
            m_pProfileManager = NULL;
            if ( disposing )
            {
              GC::SuppressFinalize(this);
            }
          }
        }
      };

      public __gc __sealed class WmaWriterProfileManager
      {
      private:
        static WmaWriterProfile* g_AudioSystemProfiles[];
        static ProfileManager* g_ProfileManager;
        WmaWriterProfileManager()
        {
        }
      public:
        
        static WmaWriterProfileManager()
        {
          g_ProfileManager = new ProfileManager();
          g_AudioSystemProfiles = new WmaWriterProfile* [AudioSystemProfilesCount];
          for (int i = 0; i < g_AudioSystemProfiles->Length; i++)
          {
            IntPtr pid = (int)AudioSystemProfilesIDs[i];
            Guid* id = __try_cast<Guid*>(Marshal::PtrToStructure(pid, __typeof(Guid)));
            g_AudioSystemProfiles[i] = new WmaWriterProfile(*id);
          }
        }

        __property static WmaWriterProfile* get_AudioSystemProfiles()[]
        {
          return g_AudioSystemProfiles;
        }
        __property static Object* get_gProfileManager()
        {
          return g_ProfileManager;
        }
        // Get the name of the WM profile specified by ID
        static String* GetProfileName(Guid ID);
      };
    }
  }
}

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


Written By
Web Developer
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions