|
Hi all!
I need to do sound compression in C#.
I record sound from microphone in wav format then I have to compress it (to Mp3, WMA of other format) to send over network and play on client computer. I found some things working with files but I can only work with streams.
I explored a lot of variants for several days but:
1. .Net Class Library doesn't include anything working with sound.
2. DirectSound doesn't do sound compression.
3. DirectShow is not included in Managed DirectX 9.0 so I can't use it from .Net
4. Windows Media Encoder doesn't work with streams
5. Audio Compression Manager maybe the only one tool to compress sound. Has anyone reference how to use it from .Net? (now I import functions from it's dll and try to use it)
Am I right in my conclusions?
Please help me!
Taras
|
|
|
|
|
No, the .NET BCL does not have anything to deal with sound. While it should've at least had some basic classes to play WAVs, sound compression is not really common in a base class library - it's often something found in extensions.
Such is the case with Managed DirectX. DirectSound doesn't need to do sound compression because it deals with filter chains. You chain a series of readers, decoders, mixers, encoders, and writers together. You can even play with this process visually using the GraphEdit application that is installed with the DirectX SDK.
And Windows Media Encoder does deal with streams, both reading from and outputing to. I've done is many times in the past.
On a more personal note, please do not email me directly with the same question that you post in the forum. I or somebody else will get to your question when we see it and feel comfortable answering it. Everyone's time is precious, and using this forum soley helps preserve the knowledge in a searchable archive (though no one ever seems to search first anymore) that is available to help everyone.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much!
You answer clears solution in general but can you write an exact links to classes, methods in DirectX or Windows Media Encoder SDK that deal with my problem because I still can't find them!
P.S. Is there any way to use DirectShow from C#?
Taras
|
|
|
|
|
Then you'll have to read the DirectX SDK - it's the only way to learn. You can also google for examples or look at the code in the samples that are installed with the SDK.
There are plenty of examples of using DirectShow in C# here on CodeProject - just search! Perhaps the 'DirectShow' keyword would return you several.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm trying to save a Button object to a file, with the following code:
[Serializable]
public class SaveSettings
{
public System.Windows.Forms.Button btn = new
System.Windows.Forms.Button();
}
System.Windows.Forms.Button testBtn = new System.Windows.Forms.Button();
SaveSettings.btn = testBtn;
Serializer.Serialize(settings.btn,"C:\\aButton.btn");
public static void Serialize(object Object, string FileName)
{
BinaryFormatter bformatter = new BinaryFormatter();
Stream stream = File.Open(FileName, FileMode.Create);
bformatter.Serialize(stream, Object);
stream.Close();
}
But I get the following exception:
An unhandled exception of
type 'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll
Additional information: The type System.Windows.Forms.Button in Assembly
System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.
What is wrong? How can I make it serializable?
I'm also trying with a Panel(containg butttons) and a TreeView(containing nodes), it all results in the same exception.(Simpel things as an ArrayList,string, int or double works fine)
Thanks in advance for your help ,
Thomas
|
|
|
|
|
Do you really want to serialize the button?
You could instead save button's Checked state and/or the button's Text label.
-rick
|
|
|
|
|
Yes, because my applicaton creats buttons in realtime.
Actualy I'm trying to save a ArrayList of Panel objects(allso made in runtime) that contains diffrent sized buttons. I've created a button class that extends the windows button class, with addisional information. Same thing for the panel.
Sorry about my bad English.
|
|
|
|
|
The Windows.Forms-Controls are not serializable, but you can export all properties of the Button and serialize the Hashtable. After deserializing the Hashtable, you can set all properties "by name".
Hashtable hashtable = new Hashtable();
ListFields(button, hashtable);
//...
private void ListFields(object obj, Hashtable ht){
BindingFlags flags = BindingFlags.Instance | BindingFlags.Public;
FieldInfo[] arrInfo = obj.GetType().GetFields(flags);
foreach(FieldInfo info in arrInfo) {
ht.Add(info.Name, info.GetValue(obj));
object fieldValue = info.GetValue(obj);
if(fieldValue != null){ ListFields(fieldValue); }
}
}
|
|
|
|
|
In a similar fashion - though a little more "serialization-friendly", you could create a class that implements ISerializationSurrogate that serializes the Button and add that to the serialization formatter's SurrogateSelector . Then you don't have to worry about overriding serialization in the parent, properly serializing field values, and stuffing them in a Hashtable to be later serialized. Using ISerializationSurrogate is pretty much the same as implementing ISerializable .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Actually i am developing a dialog like datalink dialog. The user has to select first what provider he wants. According to that provider i have to display next page of the tabcontrol how can i do that
Please explain in brief
Thanx in advance
Regards
INAM
Inam
|
|
|
|
|
tabCtl.SelectedIndex = listbox.SelectedIndex;
or
tabCtl.SelectedTab = tabpage;
|
|
|
|
|
How do I clear screen from a C# console application? Does it involve using P/invoke. THank cyril
|
|
|
|
|
Try this : http://support.microsoft.com/default.aspx?scid=kb;en-us;Q319257
|
|
|
|
|
its very urgent regarding datagrid. i want to put combobox in the datagrid. i have search the web and codeproject but normally these are set with Dock style "Fill" but infact i want without of this. I also want to
bind datagrid with the Datatable. Is this possible without using the "DatagridTableStyle" class.
Kindly friends tell me many ways so that i will select best i want.
Thanks and regards
Muhammad Sarfraz
|
|
|
|
|
Using a DataGridColumnStyle is the best way to do this. That's what they're there for - to customize the data-bindable cells in a DataGrid . There's an easy article about this in MSDN posted a few months ago at http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx[^].
If you don't want to use this mechanism, then handle the DataGrid.CurrentCellChanged event, determine if you should show a ComboBox for the current cell, then add a ComboBox to the DataGrid 's container's Controls collection with a higher TabStop than the DataGrid , and size the ComboBox to match the cell's extents. This is a really poor way of handling this and I'm not guaranteeing that it'll work.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I’m using a simple print template: http://www.webreference.com/js/column92/7.html. I programmatically set the orientation to landscape by adding the following to the code that gets executed immediately on pageLoad:
printer.orientation = “landscape”;
alert(printer.pageHeight + “ ” + printer.pageWidth);
The expected result should be an alert that displayed (850 1100). However the page orientation is not properly updated and the alert displays (1100 1100). The width of the page is updated properly, but the width is not. The settings is actually updated in PageSetup but isn’t properly refreshed in the UI. After displaying the PageSetup and closing the dialog the UI is properly refreshed.
I need to get the orientation to work properly in the UI without any problems.
|
|
|
|
|
Hi there, just wondering how i would export my c# code (from .NET) as an executable?
|
|
|
|
|
CTRL-B
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
If you don't have VS.net you can use the command line. csc.exe Here's the docs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
Visual C# .NET Compiler Options
- OUTPUT FILES -
/out:<file> Output file name (default: base name of file with main class or first file)
/target:exe Build a console executable (default) (Short form: /t:exe)
/target:winexe Build a Windows executable (Short form: /t:winexe)
/target:library Build a library (Short form: /t:library)
/target:module Build a module that can be added to another assembly (Short form: /t:module)
/define:<symbol list=""> Define conditional compilation symbol(s) (Short form: /d)
/doc:<file> XML Documentation file to generate
- INPUT FILES -
/recurse:<wildcard> Include all files in the current directory and subdirectories according to the wildcard specifications
/reference:<file list=""> Reference metadata from the specified assembly files (Short form: /r)
/addmodule:<file list=""> Link the specified modules into this assembly
- RESOURCES -
/win32res:<file> Specifies Win32 resource file (.res)
/win32icon:<file> Use this icon for the output
/resource:<resinfo> Embeds the specified resource (Short form: /res)
/linkresource:<resinfo> Links the specified resource to this assembly (Short form: /linkres)
- CODE GENERATION -
/debug[+|-] Emit debugging information
/debug:{full|pdbonly} Specify debugging type ('full' is default, and enables attaching a debugger to a running program)
/optimize[+|-] Enable optimizations (Short form: /o)
/incremental[+|-] Enable incremental compilation (Short form: /incr)
- ERRORS AND WARNINGS -
/warnaserror[+|-] Treat warnings as errors
/warn:<n> Set warning level (0-4) (Short form: /w)
/nowarn:<warning list=""> Disable specific warning messages
- LANGUAGE -
/checked[+|-] Generate overflow checks
/unsafe[+|-] Allow 'unsafe' code
- MISCELLANEOUS -
@<file> Read response file for more options
/help Display this usage message (Short form: /?)
/nologo Suppress compiler copyright message
/noconfig Do not auto include CSC.RSP file
- ADVANCED -
/baseaddress: Base address for the library to be built
/bugreport:<file> Create a 'Bug Report' file
/codepage:<n> Specifies the codepage to use when opening source files
/utf8output Output compiler messages in UTF-8 encoding
/main:<type> Specifies the type that contains the entry point (ignore all other possible entry points) (Short form: /m)
/fullpaths Compiler generates fully qualified paths
/filealign:<n> Specify the alignment used for output file sections
/nostdlib[+|-] Do not reference standard library (mscorlib.dll)
/lib:<file list=""> Specify additional directories to search in for references
|
|
|
|
|
I have some questions about Hooks.
I can do local hooks in C#,but what can I do in journal Hooks,I must know entry for DLL and the address of the procedure of my process functions.If we can do it in C#
please give me a sample.
thank you
sdfasd
|
|
|
|
|
I'm looking for some documentation on core system DLL's (in XP).
I've been trawling search engines looking for the method specs, but had no joy. Does anyone know where I could find something like this?
Cheers
Cata
|
|
|
|
|
We'll just go on MSDN : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_start_page.asp
|
|
|
|
|
|
Thanks guys, found all the stuff I was looking for and more
Cheers
Cata
|
|
|
|
|
hi
can anyone send me the source code of flow diagram?
it is very important for me.
best regards.
|
|
|
|